Skip to contentSkip to conversation

Ide patches

GIT PULL Applied John Snow 2 participants 5 messages Oct 27, 2020 – Oct 30, 2020

lore
Share & tools
lore
author
#1 lore raw

[PULL 2/3] ide: perform SRST as early as possible

In reply to John Snow

We don't need to wait for the falling edge. We can set BSY as soon as possible and begin immediately resetting the drive. Devices don't appear to need to take any specific action on the falling edge.

Message-id: [email protected]

---
 hw/ide/core.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
hw/ide/core.c +1 -3
index 84e887d4269d..98cea7ad4507 100644
@@ -2280,9 +2280,7 @@ void ide_ctrl_write(void *opaque, uint32_t addr, uint32_t val)
 
     /* Device0 and Device1 each have their own control register,
      * but QEMU models it as just one register in the controller. */
-    if ((bus->cmd & IDE_CTRL_RESET) &&
-        !(val & IDE_CTRL_RESET)) {
-        /* SRST triggers on falling edge */
+    if (!(bus->cmd & IDE_CTRL_RESET) && (val & IDE_CTRL_RESET)) {
         for (i = 0; i < 2; i++) {
             s = &bus->ifs[i];
             s->status |= BUSY_STAT;
Signature · 1 line
2.26.2
author
#2 lore raw

[PULL 1/3] ide: run diagnostic after SRST

In reply to John Snow

Software reset (SRST) should cause the diagnostic command to be run. Make an explicit call to that routine.

Message-id: [email protected]

Fixes 55adb3c45620c31f29978f209e2a44a08d34e2da
---
 hw/ide/core.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
hw/ide/core.c +2 -4
index 693b352d5ebe..84e887d4269d 100644
@@ -2254,10 +2254,8 @@ static void ide_perform_srst(IDEState *s)
     /* Cancel PIO callback, reset registers/signature, etc */
     ide_reset(s);
 
-    if (s->drive_kind == IDE_CD) {
-        /* ATAPI drives do not set READY or SEEK */
-        s->status = 0x00;
-    }
+    /* perform diagnostic */
+    cmd_exec_dev_diagnostic(s, WIN_DIAGNOSE);
 }
 
 static void ide_bus_perform_srst(void *opaque)
Signature · 1 line
2.26.2

John Snow

author
#0 lore raw

The following changes since commit a95e0396c805735c491a049b01de6f5a713fb91b:

Merge remote-tracking branch 'remotes/bonzini-gitlab/tags/for-upstream' into staging (2020-10-26 15:49:11 +0000)

are available in the Git repository at:

https://gitlab.com/jsnow/qemu.git tags/ide-pull-request

for you to fetch changes up to 1a9925e3390b6adf1125e3abaa17c80ca012bede:

ide: clear SRST after SRST finishes (2020-10-27 10:39:06 -0400)

----------------------------------------------------------------
IDE Pull request

----------------------------------------------------------------

John Snow (3):
ide: run diagnostic after SRST
ide: perform SRST as early as possible
ide: clear SRST after SRST finishes

 hw/ide/core.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)
Signature · 1 line
2.26.2
author
#3 lore raw

[PULL 3/3] ide: clear SRST after SRST finishes

The SRST protocol states that after diagnostics are complete and the status is posted, we should clear the SRST bit if it should so happen to be set.

The reset method itself should handle this, but just in case -- make our intention explicit here.

Message-id: [email protected]

---
 hw/ide/core.c | 2 ++
 1 file changed, 2 insertions(+)
hw/ide/core.c +2 -0
index 98cea7ad4507..e85821637c96 100644
@@ -2268,6 +2268,8 @@ static void ide_bus_perform_srst(void *opaque)
         s = &bus->ifs[i];
         ide_perform_srst(s);
     }
+
+    bus->cmd &= ~IDE_CTRL_RESET;
 }
 
 void ide_ctrl_write(void *opaque, uint32_t addr, uint32_t val)
Signature · 1 line
2.26.2
#4 lore raw
In reply to John Snow
Quoted 16 lines · John Snow

The following changes since commit a95e0396c805735c491a049b01de6f5a713fb91b:

Merge remote-tracking branch 'remotes/bonzini-gitlab/tags/for-upstream' into staging (2020-10-26 15:49:11 +0000)

are available in the Git repository at:

https://gitlab.com/jsnow/qemu.git tags/ide-pull-request

for you to fetch changes up to 1a9925e3390b6adf1125e3abaa17c80ca012bede:

ide: clear SRST after SRST finishes (2020-10-27 10:39:06 -0400)

----------------------------------------------------------------
IDE Pull request

Quoted 6 lines

----------------------------------------------------------------

John Snow (3):
ide: run diagnostic after SRST
ide: perform SRST as early as possible
ide: clear SRST after SRST finishes

Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/5.2
for any user-visible changes.

-- PMM