6f9d9cf
From 8175ec8e0fee5f110d91209096e77159ad6404f7 Mon Sep 17 00:00:00 2001
6f9d9cf
From: Kevin Wolf <kwolf@redhat.com>
6f9d9cf
Date: Tue, 18 Oct 2011 16:41:45 +0200
6f9d9cf
Subject: [PATCH 1/2] fdc: Fix floppy port I/O
6f9d9cf
6f9d9cf
The floppy device was broken by commit 212ec7ba (fdc: Convert to
6f9d9cf
isa_register_portio_list). While the old interface provided the port number
6f9d9cf
relative to the floppy drive's io_base, the new one provides the real port
6f9d9cf
number, so we need to apply a bitmask now to get the register number.
6f9d9cf
6f9d9cf
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
6f9d9cf
---
6f9d9cf
 hw/fdc.c |    2 ++
6f9d9cf
 1 files changed, 2 insertions(+), 0 deletions(-)
6f9d9cf
6f9d9cf
diff --git a/hw/fdc.c b/hw/fdc.c
6f9d9cf
index 9fdbc75..ec99c78 100644
6f9d9cf
--- a/hw/fdc.c
6f9d9cf
+++ b/hw/fdc.c
6f9d9cf
@@ -433,6 +433,7 @@ static uint32_t fdctrl_read (void *opaque, uint32_t reg)
6f9d9cf
     FDCtrl *fdctrl = opaque;
6f9d9cf
     uint32_t retval;
6f9d9cf
 
6f9d9cf
+    reg &= 7;
6f9d9cf
     switch (reg) {
6f9d9cf
     case FD_REG_SRA:
6f9d9cf
         retval = fdctrl_read_statusA(fdctrl);
6f9d9cf
@@ -470,6 +471,7 @@ static void fdctrl_write (void *opaque, uint32_t reg, uint32_t value)
6f9d9cf
 
6f9d9cf
     FLOPPY_DPRINTF("write reg%d: 0x%02x\n", reg & 7, value);
6f9d9cf
 
6f9d9cf
+    reg &= 7;
6f9d9cf
     switch (reg) {
6f9d9cf
     case FD_REG_DOR:
6f9d9cf
         fdctrl_write_dor(fdctrl, value);
6f9d9cf
-- 
6f9d9cf
1.7.7.5
6f9d9cf