[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 06/42] esp: fix esp_reg_read() trace event
From: |
Mark Cave-Ayland |
Subject: |
[PATCH v2 06/42] esp: fix esp_reg_read() trace event |
Date: |
Tue, 9 Feb 2021 19:29:42 +0000 |
Move the trace event to the end of the function so that it correctly reports
the returned value if it doesn't come directly from the rregs array.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
hw/scsi/esp.c | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/hw/scsi/esp.c b/hw/scsi/esp.c
index 9951472ee6..c36cb0f238 100644
--- a/hw/scsi/esp.c
+++ b/hw/scsi/esp.c
@@ -595,9 +595,8 @@ static void parent_esp_reset(ESPState *s, int irq, int
level)
uint64_t esp_reg_read(ESPState *s, uint32_t saddr)
{
- uint32_t old_val;
+ uint32_t val;
- trace_esp_mem_readb(saddr, s->rregs[saddr]);
switch (saddr) {
case ESP_FIFO:
if ((s->rregs[ESP_RSTAT] & STAT_PIO_MASK) == 0) {
@@ -612,13 +611,14 @@ uint64_t esp_reg_read(ESPState *s, uint32_t saddr)
s->ti_rptr = 0;
s->ti_wptr = 0;
}
+ val = s->rregs[ESP_FIFO];
break;
case ESP_RINTR:
/*
* Clear sequence step, interrupt register and all status bits
* except TC
*/
- old_val = s->rregs[ESP_RINTR];
+ val = s->rregs[ESP_RINTR];
s->rregs[ESP_RINTR] = 0;
s->rregs[ESP_RSTAT] &= ~STAT_TC;
s->rregs[ESP_RSEQ] = SEQ_CD;
@@ -627,16 +627,22 @@ uint64_t esp_reg_read(ESPState *s, uint32_t saddr)
esp_report_command_complete(s, s->deferred_status);
s->deferred_complete = false;
}
- return old_val;
+ break;
case ESP_TCHI:
/* Return the unique id if the value has never been written */
if (!s->tchi_written) {
- return s->chip_id;
+ val = s->chip_id;
+ } else {
+ val = s->rregs[saddr];
}
+ break;
default:
+ val = s->rregs[saddr];
break;
}
- return s->rregs[saddr];
+
+ trace_esp_mem_readb(saddr, val);
+ return val;
}
void esp_reg_write(ESPState *s, uint32_t saddr, uint64_t val)
--
2.20.1
- [PATCH v2 00/42] esp: consolidate PDMA transfer buffers and other fixes, Mark Cave-Ayland, 2021/02/09
- [PATCH v2 01/42] esp: checkpatch fixes, Mark Cave-Ayland, 2021/02/09
- [PATCH v2 02/42] esp: rename existing ESP QOM type to SYSBUS_ESP, Mark Cave-Ayland, 2021/02/09
- [PATCH v2 03/42] esp: QOMify the internal ESP device state, Mark Cave-Ayland, 2021/02/09
- [PATCH v2 04/42] esp: add vmstate_esp version to embedded ESPState, Mark Cave-Ayland, 2021/02/09
- [PATCH v2 05/42] esp: add trace event when receiving a TI command, Mark Cave-Ayland, 2021/02/09
- [PATCH v2 06/42] esp: fix esp_reg_read() trace event,
Mark Cave-Ayland <=
- [PATCH v2 07/42] esp: add PDMA trace events, Mark Cave-Ayland, 2021/02/09
- [PATCH v2 08/42] esp: determine transfer direction directly from SCSI phase, Mark Cave-Ayland, 2021/02/09
- [PATCH v2 09/42] esp: introduce esp_get_tc() and esp_set_tc(), Mark Cave-Ayland, 2021/02/09
- [PATCH v2 10/42] esp: introduce esp_get_stc(), Mark Cave-Ayland, 2021/02/09
[PATCH v2 11/42] esp: apply transfer length adjustment when STC is zero at TC load time, Mark Cave-Ayland, 2021/02/09