Patchwork fdc: fix relative seek

login
register
mail settings
Submitter Pavel Hrdina
Date July 16, 2012, 8:38 a.m.
Message ID <0f59fdb3e5569d114ee7f09791b5bc6152ba2478.1342427855.git.phrdina@redhat.com>
Download mbox | patch
Permalink /patch/171146/
State New
Headers show

Comments

Pavel Hrdina - July 16, 2012, 8:38 a.m.
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
---
 hw/fdc.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Patch

diff --git a/hw/fdc.c b/hw/fdc.c
index edf0706..decb1f7 100644
--- a/hw/fdc.c
+++ b/hw/fdc.c
@@ -1705,7 +1705,8 @@  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 */
@@ -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 */