Index: /trunk/src/VBox/Devices/Storage/DevBusLogic.cpp
===================================================================
--- /trunk/src/VBox/Devices/Storage/DevBusLogic.cpp	(revision 81809)
+++ /trunk/src/VBox/Devices/Storage/DevBusLogic.cpp	(revision 81810)
@@ -345,7 +345,4 @@
     bool                            afPadding[2];
 
-    /** Base address of the memory mapping. */
-    RTGCPHYS                        MMIOBase;
-
     /** Status register - Readonly. */
     volatile uint8_t                regStatus;
@@ -491,4 +488,6 @@
     /** PCI Region \#0: I/O ports. */
     IOMIOPORTHANDLE                 hIoPortsPci;
+    /** PCI Region \#1: MMIO (32 bytes, but probably rounded up to 4KB). */
+    IOMMMIOHANDLE                   hMmio;
 } BUSLOGIC;
 /** Pointer to the shared BusLogic device emulation state. */
@@ -2622,40 +2621,24 @@
 
 /**
- * Memory mapped I/O Handler for read operations.
- *
- * @returns VBox status code.
- *
- * @param   pDevIns     The device instance.
- * @param   pvUser      User argument.
- * @param   GCPhysAddr  Physical address (in GC) where the read starts.
- * @param   pv          Where to store the result.
- * @param   cb          Number of bytes read.
- */
-PDMBOTHCBDECL(int) buslogicMMIORead(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS GCPhysAddr, void *pv, unsigned cb)
-{
-    RT_NOREF_PV(pDevIns); RT_NOREF_PV(pvUser); RT_NOREF_PV(GCPhysAddr); RT_NOREF_PV(pv); RT_NOREF_PV(cb);
+ * @callback_method_impl{FNIOMMMIONEWREAD}
+ */
+static DECLCALLBACK(VBOXSTRICTRC) buslogicMMIORead(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS off, void *pv, unsigned cb)
+{
+    RT_NOREF(pDevIns, pvUser, off, pv, cb);
 
     /* the linux driver does not make use of the MMIO area. */
-    AssertMsgFailed(("MMIO Read\n"));
+    ASSERT_GUEST_MSG_FAILED(("MMIO Read: %RGp LB %u\n", off, cb));
     return VINF_SUCCESS;
 }
 
 /**
- * Memory mapped I/O Handler for write operations.
- *
- * @returns VBox status code.
- *
- * @param   pDevIns     The device instance.
- * @param   pvUser      User argument.
- * @param   GCPhysAddr  Physical address (in GC) where the read starts.
- * @param   pv          Where to fetch the result.
- * @param   cb          Number of bytes to write.
- */
-PDMBOTHCBDECL(int) buslogicMMIOWrite(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS GCPhysAddr, void const *pv, unsigned cb)
-{
-    RT_NOREF_PV(pDevIns); RT_NOREF_PV(pvUser); RT_NOREF_PV(GCPhysAddr); RT_NOREF_PV(pv); RT_NOREF_PV(cb);
+ * @callback_method_impl{FNIOMMMIONEWWRITE}
+ */
+static DECLCALLBACK(VBOXSTRICTRC) buslogicMMIOWrite(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS off, void const *pv, unsigned cb)
+{
+    RT_NOREF(pDevIns, pvUser, off, pv, cb);
 
     /* the linux driver does not make use of the MMIO area. */
-    AssertMsgFailed(("MMIO Write\n"));
+    ASSERT_GUEST_MSG_FAILED(("MMIO Write: %RGp LB %u: %.*Rhxs\n", off, cb, cb, pv));
     return VINF_SUCCESS;
 }
@@ -2933,52 +2916,4 @@
 }
 
-
-/**
- * @callback_method_impl{FNPCIIOREGIONMAP}
- */
-static DECLCALLBACK(int) buslogicR3MmioMap(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t iRegion,
-                                           RTGCPHYS GCPhysAddress, RTGCPHYS cb, PCIADDRESSSPACE enmType)
-{
-    PBUSLOGIC  pThis = PDMDEVINS_2_DATA(pDevIns, PBUSLOGIC);
-    int        rc    = VINF_SUCCESS;
-    RT_NOREF(pPciDev, iRegion);
-
-    Log2(("%s: registering MMIO area at GCPhysAddr=%RGp cb=%RGp\n", __FUNCTION__, GCPhysAddress, cb));
-
-    Assert(cb >= 32);
-    Assert(pPciDev == pDevIns->apPciDevs[0]);
-
-    if (enmType == PCI_ADDRESS_SPACE_MEM)
-    {
-        /* We use the assigned size here, because we currently only support page aligned MMIO ranges. */
-        rc = PDMDevHlpMMIORegister(pDevIns, GCPhysAddress, cb, NULL /*pvUser*/,
-                                   IOMMMIO_FLAGS_READ_PASSTHRU | IOMMMIO_FLAGS_WRITE_PASSTHRU,
-                                   buslogicMMIOWrite, buslogicMMIORead, "BusLogic MMIO");
-        if (RT_FAILURE(rc))
-            return rc;
-
-        if (pThis->fR0Enabled)
-        {
-            rc = PDMDevHlpMMIORegisterR0(pDevIns, GCPhysAddress, cb, NIL_RTR0PTR /*pvUser*/,
-                                         "buslogicMMIOWrite", "buslogicMMIORead");
-            if (RT_FAILURE(rc))
-                return rc;
-        }
-
-        if (pThis->fGCEnabled)
-        {
-            rc = PDMDevHlpMMIORegisterRC(pDevIns, GCPhysAddress, cb, NIL_RTRCPTR /*pvUser*/,
-                                         "buslogicMMIOWrite", "buslogicMMIORead");
-            if (RT_FAILURE(rc))
-                return rc;
-        }
-
-        pThis->MMIOBase = GCPhysAddress;
-    }
-    else
-        AssertMsgFailed(("Invalid enmType=%d\n", enmType));
-
-    return rc;
-}
 
 static int buslogicR3ReqComplete(PBUSLOGIC pThis, PBUSLOGICREQ pReq, int rcReq)
@@ -3790,5 +3725,6 @@
     else
         pHlp->pfnPrintf(pHlp, "PCI I/O=%04x ISA I/O=%RTiop MMIO=%RGp IRQ=%u ",
-                        PDMDevHlpIoPortGetMappingAddress(pDevIns, pThis->hIoPortsPci), pThis->IOISABase, pThis->MMIOBase,
+                        PDMDevHlpIoPortGetMappingAddress(pDevIns, pThis->hIoPortsPci), pThis->IOISABase,
+                        PDMDevHlpMmioGetMappingAddress(pDevIns, pThis->hMmio),
                         PCIDevGetInterruptLine(pDevIns->apPciDevs[0]));
     pHlp->pfnPrintf(pHlp, "GC=%RTbool R0=%RTbool\n",
@@ -4246,7 +4182,9 @@
         AssertRCReturn(rc, rc);
 
-        rc = PDMDevHlpPCIIORegionRegister(pDevIns, 1, 32, PCI_ADDRESS_SPACE_MEM, buslogicR3MmioMap);
-        if (RT_FAILURE(rc))
-            return rc;
+        rc = PDMDevHlpPCIIORegionCreateMmio(pDevIns, 1 /*iPciRegion*/, 32 /*cbRegion*/, PCI_ADDRESS_SPACE_MEM,
+                                            buslogicMMIOWrite, buslogicMMIORead, NULL /*pvUser*/,
+                                            IOMMMIO_FLAGS_READ_PASSTHRU | IOMMMIO_FLAGS_WRITE_PASSTHRU,
+                                            "BusLogic MMIO", &pThis->hMmio);
+        AssertRCReturn(rc, rc);
     }
 
@@ -4405,4 +4343,7 @@
 
     int rc = PDMDevHlpIoPortSetUpContext(pDevIns, pThis->hIoPortsPci, buslogicIOPortWrite, buslogicIOPortRead, NULL /*pvUser*/);
+    AssertRCReturn(rc, rc);
+
+    rc = PDMDevHlpMmioSetUpContext(pDevIns, pThis->hMmio, buslogicMMIOWrite, buslogicMMIORead, NULL /*pvUser*/);
     AssertRCReturn(rc, rc);
 
