diff -ruN v45b1\driver\id_init.cpp v45c\driver\id_init.cpp
--- v45b1\driver\id_init.cpp	Wed May 21 11:07:50 2014
+++ v45c\driver\id_init.cpp	Fri Oct 17 12:08:26 2014
@@ -522,7 +522,8 @@
                 ScsiPortFreeDeviceBase(HwDeviceExtension,
                                        deviceExtension->BaseIoAddressBM_0);
 
-            deviceExtension->BaseIoAddressBM_0 = 0;
+            deviceExtension->BaseIoAddressBM_0.Addr = 0;
+            deviceExtension->BaseIoAddressBM_0.MemIo = 0;
             deviceExtension->BusMaster = DMA_MODE_NONE;
             deviceExtension->MaxTransferMode = ATA_PIO4;
             break;
@@ -1170,22 +1171,61 @@
             break;
         }
         if(deviceExtension->MaxTransferMode >= ATA_SA150) {
+
+            BOOLEAN OrigAHCI = FALSE;
+
             GetPciConfig1(0x90, tmp8);
             KdPrint2((PRINT_PREFIX "Intel chip config: %x\n", tmp8));
             /* SATA parts can be either compat or AHCI */
+            MemIo = FALSE;
             if(ChipFlags & UNIATA_AHCI) {
-
+                OrigAHCI = TRUE;
                 if(tmp8 & 0xc0) {
                     //KdPrint2((PRINT_PREFIX "AHCI not supported yet\n"));
                     //return FALSE;
                     KdPrint2((PRINT_PREFIX "try run AHCI\n"));
                     break;
                 }
-                KdPrint2((PRINT_PREFIX "Compatible mode\n"));
+                BaseIoAddressBM = AtapiGetIoRange(HwDeviceExtension, ConfigInfo, pciData, SystemIoBusNumber,
+                                        4, 0, sizeof(IDE_BUSMASTER_REGISTERS));
+                if(BaseIoAddressBM) {
+                    KdPrint2((PRINT_PREFIX "Intel BM check at %x\n", BaseIoAddressBM));
+                    /* check if we really have valid BM registers */
+                    if((*ConfigInfo->AccessRanges)[4].RangeInMemory) {
+                        KdPrint2((PRINT_PREFIX "MemIo[4]\n"));
+                        MemIo = TRUE;
+                    }
+                    deviceExtension->BaseIoAddressBM_0.Addr  = BaseIoAddressBM;
+                    deviceExtension->BaseIoAddressBM_0.MemIo = MemIo;
+
+                    tmp8 = AtapiReadPortEx1(NULL, (ULONGIO_PTR)(&deviceExtension->BaseIoAddressBM_0),IDX_BM_Status);
+                    KdPrint2((PRINT_PREFIX "BM status: %x\n", tmp8));
+                    /* cleanup */
+                    ScsiPortFreeDeviceBase(HwDeviceExtension, (PCHAR)BaseIoAddressBM);
+                    deviceExtension->BaseIoAddressBM_0.Addr = 0;
+                    deviceExtension->BaseIoAddressBM_0.MemIo = 0;
+
+                    if(tmp8 == 0xff) {
+                        KdPrint2((PRINT_PREFIX "invalid BM status, keep AHCI mode\n"));
+                        break;
+                    }
+                }
+                KdPrint2((PRINT_PREFIX "Compatible mode, reallocate LUNs\n"));
+                deviceExtension->NumberLuns = 2; // we may be in Legacy mode
+                if(!UniataAllocateLunExt(deviceExtension, 2)) {
+                    KdPrint2((PRINT_PREFIX "can't re-allocate Luns\n"));
+                    return STATUS_UNSUCCESSFUL;
+                }
             }
             deviceExtension->HwFlags &= ~UNIATA_AHCI;
 
+            MemIo = FALSE;
             /* if BAR(5) is IO it should point to SATA interface registers */
+            if(OrigAHCI) {
+                /* Skip BAR(5) in compatible mode */
+                KdPrint2((PRINT_PREFIX "Ignore BAR5 on compatible\n"));
+                BaseMemAddress = 0;
+            } else
             if(deviceExtension->DevID == 0x28288086 &&
                 pciData->u.type0.SubVendorID == 0x106b) {
                 /* Skip BAR(5) on ICH8M Apples, system locks up on access. */
@@ -1195,7 +1235,7 @@
                 BaseMemAddress = AtapiGetIoRange(HwDeviceExtension, ConfigInfo, pciData, SystemIoBusNumber,
                                     5, 0, 0x10);
                 if(BaseMemAddress && (*ConfigInfo->AccessRanges)[5].RangeInMemory) {
-                    KdPrint2((PRINT_PREFIX "MemIo\n"));
+                    KdPrint2((PRINT_PREFIX "MemIo[5]\n"));
                     MemIo = TRUE;
                 }
             }
