Patchwork [v3,1/2] fdc: fix relative seek

login
register
mail settings
Submitter Pavel Hrdina
Date July 16, 2012, 1:48 p.m.
Message ID <3911cbfe9b9c2a9fd2e07bf7f2ff327a7b9a1a1c.1342446287.git.phrdina@redhat.com>
Download mbox | patch
Permalink /patch/171199/
State New
Headers show

Comments

Pavel Hrdina - July 16, 2012, 1:48 p.m.
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
---
 hw/fdc.c |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
Kevin Wolf - July 16, 2012, 2:01 p.m.
Am 16.07.2012 15:48, schrieb Pavel Hrdina:
> Signed-off-by: Pavel Hrdina <phrdina@redhat.com>

Thanks, applied both to the block branch.

Kevin

Patch

diff --git a/hw/fdc.c b/hw/fdc.c
index edf0706..9f84931 100644
--- a/hw/fdc.c
+++ b/hw/fdc.c
@@ -1695,7 +1695,7 @@  static void fdctrl_handle_drive_specification_command(FDCtrl *fdctrl, int direct
     }
 }
 
-static void fdctrl_handle_relative_seek_out(FDCtrl *fdctrl, int direction)
+static void fdctrl_handle_relative_seek_in(FDCtrl *fdctrl, int direction)
 {
     FDrive *cur_drv;
 
@@ -1705,14 +1705,15 @@  static void fdctrl_handle_relative_seek_out(FDCtrl *fdctrl, int direction)
         fd_seek(cur_drv, cur_drv->head, cur_drv->max_track - 1,
                 cur_drv->sect, 1);
     } else {
-        fd_seek(cur_drv, cur_drv->head, fdctrl->fifo[2], cur_drv->sect, 1);
+        fd_seek(cur_drv, cur_drv->head,
+                cur_drv->track + fdctrl->fifo[2], cur_drv->sect, 1);
     }
     fdctrl_reset_fifo(fdctrl);
     /* Raise Interrupt */
     fdctrl_raise_irq(fdctrl, FD_SR0_SEEK);
 }
 
-static void fdctrl_handle_relative_seek_in(FDCtrl *fdctrl, int direction)
+static void fdctrl_handle_relative_seek_out(FDCtrl *fdctrl, int direction)
 {
     FDrive *cur_drv;
 
@@ -1721,7 +1722,8 @@  static void fdctrl_handle_relative_seek_in(FDCtrl *fdctrl, int direction)
     if (fdctrl->fifo[2] > cur_drv->track) {
         fd_seek(cur_drv, cur_drv->head, 0, cur_drv->sect, 1);
     } else {
-        fd_seek(cur_drv, cur_drv->head, fdctrl->fifo[2], cur_drv->sect, 1);
+        fd_seek(cur_drv, cur_drv->head,
+                cur_drv->track - fdctrl->fifo[2], cur_drv->sect, 1);
     }
     fdctrl_reset_fifo(fdctrl);
     /* Raise Interrupt */