Skip to content

Commit

Permalink
esp.c: remove do_cmd from ESPState
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
mcayland committed Feb 13, 2024
1 parent df91fd4 commit 6d97f5a
Showing 1 changed file with 0 additions and 13 deletions.
13 changes: 0 additions & 13 deletions hw/scsi/esp.c
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,6 @@ static void satn_pdma_cb(ESPState *s)

if (!esp_get_tc(s) && !fifo8_is_empty(&s->cmdfifo)) {
s->cmdfifo_cdb_offset = 1;
s->do_cmd = 0;
do_cmd(s);
}
}
Expand All @@ -400,13 +399,11 @@ static void handle_satn(ESPState *s)
cmdlen = get_cmd(s, ESP_CMDFIFO_SZ);
if (cmdlen > 0) {
s->cmdfifo_cdb_offset = 1;
s->do_cmd = 0;
do_cmd(s);
} else if (cmdlen == 0) {
if (s->dma) {
esp_raise_drq(s);
}
s->do_cmd = 1;
/* Target present, but no cmd yet - switch to command phase */
s->rregs[ESP_RSEQ] = SEQ_CD;
esp_set_phase(s, STAT_CD);
Expand All @@ -428,13 +425,11 @@ static void handle_s_without_atn(ESPState *s)
cmdlen = get_cmd(s, ESP_CMDFIFO_SZ);
if (cmdlen > 0) {
s->cmdfifo_cdb_offset = 0;
s->do_cmd = 0;
do_cmd(s);
} else if (cmdlen == 0) {
if (s->dma) {
esp_raise_drq(s);
}
s->do_cmd = 1;
/* Target present, but no cmd yet - switch to command phase */
s->rregs[ESP_RSEQ] = SEQ_CD;
esp_set_phase(s, STAT_CD);
Expand All @@ -453,7 +448,6 @@ static void satn_stop_pdma_cb(ESPState *s)

if (!esp_get_tc(s) && !fifo8_is_empty(&s->cmdfifo)) {
trace_esp_handle_satn_stop(fifo8_num_used(&s->cmdfifo));
s->do_cmd = 1;
s->cmdfifo_cdb_offset = 1;
esp_set_phase(s, STAT_CD);
s->rregs[ESP_RSTAT] |= STAT_TC;
Expand All @@ -478,7 +472,6 @@ static void handle_satn_stop(ESPState *s)
cmdlen = get_cmd(s, 1);
if (cmdlen > 0) {
trace_esp_handle_satn_stop(fifo8_num_used(&s->cmdfifo));
s->do_cmd = 1;
s->cmdfifo_cdb_offset = 1;
esp_set_phase(s, STAT_MO);
s->rregs[ESP_RINTR] |= INTR_BS | INTR_FC;
Expand All @@ -488,7 +481,6 @@ static void handle_satn_stop(ESPState *s)
if (s->dma) {
esp_raise_drq(s);
}
s->do_cmd = 1;
/* Target present, switch to message out phase */
s->rregs[ESP_RSEQ] = SEQ_MO;
esp_set_phase(s, STAT_MO);
Expand Down Expand Up @@ -567,7 +559,6 @@ static void do_dma_pdma_cb(ESPState *s)
}

/* Command has been received */
s->do_cmd = 0;
do_cmd(s);
} else {
/*
Expand Down Expand Up @@ -669,7 +660,6 @@ static void esp_do_dma(ESPState *s)
}

/* Command has been received */
s->do_cmd = 0;
do_cmd(s);
} else {
/*
Expand Down Expand Up @@ -805,7 +795,6 @@ static void esp_do_nodma(ESPState *s)
}

/* Command has been received */
s->do_cmd = 0;
do_cmd(s);
} else {
/*
Expand Down Expand Up @@ -949,7 +938,6 @@ void esp_transfer_data(SCSIRequest *req, uint32_t len)
int to_device = (esp_get_phase(s) == STAT_DO);
uint32_t dmalen = esp_get_tc(s);

assert(!s->do_cmd);
trace_esp_transfer_data(dmalen, s->ti_size);
s->async_len = len;
s->async_buf = scsi_req_get_buf(req);
Expand Down Expand Up @@ -1012,7 +1000,6 @@ void esp_hard_reset(ESPState *s)
fifo8_reset(&s->fifo);
fifo8_reset(&s->cmdfifo);
s->dma = 0;
s->do_cmd = 0;
s->dma_cb = NULL;

s->rregs[ESP_CFG1] = 7;
Expand Down

0 comments on commit 6d97f5a

Please sign in to comment.