* of the sector count register location, with interrupts disabled
  * to ensure that the reads all happen together.
  */
-static void ata_vlb_sync(ide_drive_t *drive, unsigned long port)
+static void ata_vlb_sync(unsigned long port)
 {
-       (void) HWIF(drive)->INB(port);
-       (void) HWIF(drive)->INB(port);
-       (void) HWIF(drive)->INB(port);
+       (void)inb(port);
+       (void)inb(port);
+       (void)inb(port);
 }
 
 /*
        if (io_32bit) {
                unsigned long uninitialized_var(flags);
 
-               if (io_32bit & 2) {
+               if ((io_32bit & 2) && !mmio) {
                        local_irq_save(flags);
-                       ata_vlb_sync(drive, io_ports->nsect_addr);
+                       ata_vlb_sync(io_ports->nsect_addr);
                }
 
                if (mmio)
                else
                        insl(data_addr, buf, len / 4);
 
-               if (io_32bit & 2)
+               if ((io_32bit & 2) && !mmio)
                        local_irq_restore(flags);
 
                if ((len & 3) >= 2) {
        if (io_32bit) {
                unsigned long uninitialized_var(flags);
 
-               if (io_32bit & 2) {
+               if ((io_32bit & 2) && !mmio) {
                        local_irq_save(flags);
-                       ata_vlb_sync(drive, io_ports->nsect_addr);
+                       ata_vlb_sync(io_ports->nsect_addr);
                }
 
                if (mmio)
                else
                        outsl(data_addr, buf, len / 4);
 
-               if (io_32bit & 2)
+               if ((io_32bit & 2) && !mmio)
                        local_irq_restore(flags);
 
                if ((len & 3) >= 2) {