Index: /trunk/src/VBox/Devices/Storage/DevAHCI.cpp
===================================================================
--- /trunk/src/VBox/Devices/Storage/DevAHCI.cpp	(revision 64175)
+++ /trunk/src/VBox/Devices/Storage/DevAHCI.cpp	(revision 64176)
@@ -60,5 +60,4 @@
 #include "PIIX3ATABmDma.h"
 #include "ide.h"
-#include "ATAPIPassthrough.h"
 #include "VBoxDD.h"
 
@@ -80,8 +79,8 @@
 #define AHCI_NR_COMMAND_SLOTS   32
 
-#define AHCI_MAX_ALLOC_TOO_MUCH 20
-
 /** The current saved state version. */
-#define AHCI_SAVED_STATE_VERSION                        8
+#define AHCI_SAVED_STATE_VERSION                        9
+/** The saved state version before the ATAPI emulation was removed and the generic SCSI driver was used. */
+#define AHCI_SAVED_STATE_VERSION_PRE_ATAPI_REMOVE       8
 /** The saved state version before changing the port reset logic in an incompatible way. */
 #define AHCI_SAVED_STATE_VERSION_PRE_PORT_RESET_CHANGES 7
@@ -130,17 +129,4 @@
 #define AHCI_FIRMWARE_REVISION_LENGTH         8
 #define AHCI_MODEL_NUMBER_LENGTH             40
-#define AHCI_ATAPI_INQUIRY_VENDOR_ID_LENGTH   8
-#define AHCI_ATAPI_INQUIRY_PRODUCT_ID_LENGTH 16
-#define AHCI_ATAPI_INQUIRY_REVISION_LENGTH    4
-
-/* MediaEventStatus */
-#define ATA_EVENT_STATUS_UNCHANGED              0    /**< medium event status not changed */
-#define ATA_EVENT_STATUS_MEDIA_NEW              1    /**< new medium inserted */
-#define ATA_EVENT_STATUS_MEDIA_REMOVED          2    /**< medium removed */
-#define ATA_EVENT_STATUS_MEDIA_CHANGED          3    /**< medium was removed + new medium was inserted */
-#define ATA_EVENT_STATUS_MEDIA_EJECT_REQUESTED  4    /**< medium eject requested (eject button pressed) */
-
-/* Media track type */
-#define ATA_MEDIA_TYPE_UNKNOWN                  0    /**< unknown CD type */
 
 /** ATAPI sense info size. */
@@ -314,5 +300,4 @@
  * @implements PDMIMEDIAPORT
  * @implements PDMIMEDIAEXPORT
- * @implements PDMIMOUNTNOTIFY
  */
 typedef struct AHCIPort
@@ -380,6 +365,4 @@
     /** Attached device is a CD/DVD drive. */
     bool                            fATAPI;
-    /** Passthrough SCSI commands. */
-    bool                            fATAPIPassthrough;
     /** Flag whether this port is in a reset state. */
     volatile bool                   fPortReset;
@@ -407,12 +390,6 @@
     /** ATAPI sense data. */
     uint8_t                         abATAPISense[ATAPI_SENSE_SIZE];
-    /** HACK: Countdown till we report a newly unmounted drive as mounted. */
-    uint8_t                         cNotifiedMediaChange;
     /** Exponent of logical sectors in a physical sector, number of logical sectors is 2^exp. */
     uint8_t                         cLogSectorsPerPhysicalExp;
-    /** The same for GET_EVENT_STATUS for mechanism */
-    volatile uint32_t               MediaEventStatus;
-    /** Media type if known. */
-    volatile uint32_t               MediaTrackType;
     /** The LUN. */
     RTUINT                          iLUN;
@@ -443,6 +420,4 @@
     /** Pointer to the attached driver's extended interface. */
     R3PTRTYPE(PPDMIMEDIAEX)         pDrvMediaEx;
-    /** Pointer to the attached driver's mount interface. */
-    R3PTRTYPE(PPDMIMOUNT)           pDrvMount;
     /** The base interface. */
     PDMIBASE                        IBase;
@@ -451,6 +426,4 @@
     /** The extended media port interface. */
     PDMIMEDIAEXPORT                 IMediaExPort;
-    /** The mount notify interface. */
-    PDMIMOUNTNOTIFY                 IMountNotify;
     /** Physical geometry of this image. */
     PDMMEDIAGEOMETRY                PCHSGeometry;
@@ -464,6 +437,4 @@
     /** First task throwing an error. */
     R3PTRTYPE(volatile PAHCIREQ)    pTaskErr;
-    /** The current tracklist of the loaded medium if passthrough is used. */
-    R3PTRTYPE(PTRACKLIST)           pTrackList;
 
     /** The event semaphore the processing thread waits on. */
@@ -491,10 +462,4 @@
     /** The model number to use for IDENTIFY DEVICE commands. */
     char                            szModelNumber[AHCI_MODEL_NUMBER_LENGTH+1]; /** < one extra byte for termination */
-    /** The vendor identification string for SCSI INQUIRY commands. */
-    char                            szInquiryVendorId[AHCI_ATAPI_INQUIRY_VENDOR_ID_LENGTH+1];
-    /** The product identification string for SCSI INQUIRY commands. */
-    char                            szInquiryProductId[AHCI_ATAPI_INQUIRY_PRODUCT_ID_LENGTH+1];
-    /** The revision string for SCSI INQUIRY commands. */
-    char                            szInquiryRevision[AHCI_ATAPI_INQUIRY_REVISION_LENGTH+1];
     /** Error counter */
     uint32_t                        cErrors;
@@ -904,6 +869,4 @@
 
 #define PCIDEV_2_PAHCI(pPciDev)                  ( (PAHCI)(pPciDev) )
-#define PDMIMOUNT_2_PAHCIPORT(pInterface)        ( (PAHCIPort)((uintptr_t)(pInterface) - RT_OFFSETOF(AHCIPort, IMount)) )
-#define PDMIMOUNTNOTIFY_2_PAHCIPORT(pInterface)  ( (PAHCIPort)((uintptr_t)(pInterface) - RT_OFFSETOF(AHCIPort, IMountNotify)) )
 #define PDMIBASE_2_PAHCIPORT(pInterface)         ( (PAHCIPort)((uintptr_t)(pInterface) - RT_OFFSETOF(AHCIPort, IBase)) )
 #define PDMIMEDIAPORT_2_PAHCIPORT(pInterface)    ( (PAHCIPort)((uintptr_t)(pInterface) - RT_OFFSETOF(AHCIPort, IPort)) )
@@ -2034,7 +1997,4 @@
     pAhciPort->u32CurrentCommandSlot = 0;
 
-    ASMAtomicWriteU32(&pAhciPort->MediaEventStatus, ATA_EVENT_STATUS_UNCHANGED);
-    ASMAtomicWriteU32(&pAhciPort->MediaTrackType, ATA_MEDIA_TYPE_UNKNOWN);
-
     if (pAhciPort->pDrvBase)
     {
@@ -2655,5 +2615,4 @@
     PDMIBASE_RETURN_INTERFACE(pszIID, PDMIMEDIAPORT, &pAhciPort->IPort);
     PDMIBASE_RETURN_INTERFACE(pszIID, PDMIMEDIAEXPORT, &pAhciPort->IMediaExPort);
-    PDMIBASE_RETURN_INTERFACE(pszIID, PDMIMOUNTNOTIFY, &pAhciPort->IMountNotify);
     return NULL;
 }
@@ -3093,5 +3052,4 @@
 
     /* Send a status good D2H FIS. */
-    ASMAtomicWriteU32(&pAhciPort->MediaEventStatus, ATA_EVENT_STATUS_UNCHANGED);
     pAhciPort->fResetDevice = false;
     if (pAhciPort->regCMD & AHCI_PORT_CMD_FRE)
@@ -3901,5 +3859,5 @@
                     ahciReqSetStatus(pAhciReq, 0, ATA_STAT_READY | ATA_STAT_SEEK);
                     pAhciReq->cmdFis[AHCI_CMDFIS_SECTN] = (pAhciReq->cmdFis[AHCI_CMDFIS_SECTN] & ~7)
-                        /*| ((pAhciReq->enmType != AHCITXDIR_WRITE) ? ATAPI_INT_REASON_IO : 0) @todo */
+                        | ((pAhciReq->fFlags & AHCI_REQ_XFER_2_HOST) ? ATAPI_INT_REASON_IO : 0)
                         | (!pAhciReq->cbTransfer ? ATAPI_INT_REASON_CD : 0);
                 }
@@ -3910,4 +3868,5 @@
                                                           ATAPI_INT_REASON_IO | ATAPI_INT_REASON_CD;
                     pAhciReq->cbTransfer = 0;
+                    LogFlowFunc(("SCSI request completed with %u status\n", pAhciReq->u8ScsiSts));
                 }
             }
@@ -4242,5 +4201,5 @@
                 pAhciReq->cbTransfer = cbData;
                 pAhciReq->cmdFis[AHCI_CMDFIS_SECTN] = (pAhciReq->cmdFis[AHCI_CMDFIS_SECTN] & ~7)
-                    /*| ((pAhciReq->enmTxDir != AHCITXDIR_WRITE) ? ATAPI_INT_REASON_IO : 0) @todo */
+                    | ((pAhciReq->fFlags & AHCI_REQ_XFER_2_HOST) ? ATAPI_INT_REASON_IO : 0)
                     | (!pAhciReq->cbTransfer ? ATAPI_INT_REASON_CD : 0);
 
@@ -5042,6 +5001,4 @@
         SSMR3PutBool(pSSM, pThis->ahciPort[i].fATAPI);
         SSMR3PutMem(pSSM, &pThis->ahciPort[i].abATAPISense[0], sizeof(pThis->ahciPort[i].abATAPISense));
-        SSMR3PutU8(pSSM, pThis->ahciPort[i].cNotifiedMediaChange);
-        SSMR3PutU32(pSSM, pThis->ahciPort[i].MediaEventStatus);
     }
 
@@ -5287,6 +5244,9 @@
                 SSMR3GetBool(pSSM, &pThis->ahciPort[i].fATAPI);
                 SSMR3GetMem(pSSM, pThis->ahciPort[i].abATAPISense, sizeof(pThis->ahciPort[i].abATAPISense));
-                SSMR3GetU8(pSSM, &pThis->ahciPort[i].cNotifiedMediaChange);
-                SSMR3GetU32(pSSM, (uint32_t*)&pThis->ahciPort[i].MediaEventStatus);
+                if (uVersion < AHCI_SAVED_STATE_VERSION_PRE_ATAPI_REMOVE)
+                {
+                    SSMR3Skip(pSSM, 1); /* cNotifiedMediaChange. */
+                    SSMR3Skip(pSSM, 4); /* MediaEventStatus */
+                }
             }
             else if (pThis->ahciPort[i].fATAPI)
@@ -5371,6 +5331,4 @@
                     VERR_PDM_MISSING_INTERFACE);
 
-    pAhciPort->pDrvMount = PDMIBASE_QUERY_INTERFACE(pAhciPort->pDrvBase, PDMIMOUNT);
-
     /*
      * Validate type.
@@ -5380,7 +5338,4 @@
                     ("AHCI configuration error: LUN#%d isn't a disk or cd/dvd. enmType=%u\n", pAhciPort->iLUN, enmType),
                     VERR_PDM_UNSUPPORTED_BLOCK_TYPE);
-    AssertMsgReturn(enmType == PDMMEDIATYPE_HARD_DISK || pAhciPort->pDrvMount,
-                    ("AHCI configuration error: LUN#%d is CD/DVD-ROM without a mountable interface\n", pAhciPort->iLUN),
-                    VERR_INTERNAL_ERROR);
 
     int rc = pAhciPort->pDrvMediaEx->pfnIoReqAllocSizeSet(pAhciPort->pDrvMediaEx, sizeof(AHCIREQ));
@@ -5598,41 +5553,4 @@
         return PDMDEV_SET_ERROR(pDevIns, rc,
                     N_("AHCI configuration error: \"LogicalSectorsPerPhysical\" must be between 0 and 15"));
-
-    /* There are three other identification strings for CD drives used for INQUIRY */
-    if (pAhciPort->fATAPI)
-    {
-        rc = CFGMR3QueryStringDef(pCfgNode, "ATAPIVendorId", pAhciPort->szInquiryVendorId, sizeof(pAhciPort->szInquiryVendorId),
-                                  "VBOX");
-        if (RT_FAILURE(rc))
-        {
-            if (rc == VERR_CFGM_NOT_ENOUGH_SPACE)
-                return PDMDEV_SET_ERROR(pDevIns, VERR_INVALID_PARAMETER,
-                                N_("AHCI configuration error: \"ATAPIVendorId\" is longer than 16 bytes"));
-            return PDMDEV_SET_ERROR(pDevIns, rc,
-                    N_("AHCI configuration error: failed to read \"ATAPIVendorId\" as string"));
-        }
-
-        rc = CFGMR3QueryStringDef(pCfgNode, "ATAPIProductId", pAhciPort->szInquiryProductId, sizeof(pAhciPort->szInquiryProductId),
-                                  "CD-ROM");
-        if (RT_FAILURE(rc))
-        {
-            if (rc == VERR_CFGM_NOT_ENOUGH_SPACE)
-                return PDMDEV_SET_ERROR(pDevIns, VERR_INVALID_PARAMETER,
-                                N_("AHCI configuration error: \"ATAPIProductId\" is longer than 16 bytes"));
-            return PDMDEV_SET_ERROR(pDevIns, rc,
-                    N_("AHCI configuration error: failed to read \"ATAPIProductId\" as string"));
-        }
-
-        rc = CFGMR3QueryStringDef(pCfgNode, "ATAPIRevision", pAhciPort->szInquiryRevision, sizeof(pAhciPort->szInquiryRevision),
-                                  "1.0");
-        if (RT_FAILURE(rc))
-        {
-            if (rc == VERR_CFGM_NOT_ENOUGH_SPACE)
-                return PDMDEV_SET_ERROR(pDevIns, VERR_INVALID_PARAMETER,
-                                N_("AHCI configuration error: \"ATAPIRevision\" is longer than 4 bytes"));
-            return PDMDEV_SET_ERROR(pDevIns, rc,
-                    N_("AHCI configuration error: failed to read \"ATAPIRevision\" as string"));
-        }
-    }
 
     return rc;
Index: /trunk/src/VBox/Devices/testcase/tstDeviceStructSizeRC.cpp
===================================================================
--- /trunk/src/VBox/Devices/testcase/tstDeviceStructSizeRC.cpp	(revision 64175)
+++ /trunk/src/VBox/Devices/testcase/tstDeviceStructSizeRC.cpp	(revision 64176)
@@ -1385,5 +1385,4 @@
     GEN_CHECK_OFF(AHCIPort, fFirstD2HFisSend);
     GEN_CHECK_OFF(AHCIPort, fATAPI);
-    GEN_CHECK_OFF(AHCIPort, fATAPIPassthrough);
     GEN_CHECK_OFF(AHCIPort, fPortReset);
     GEN_CHECK_OFF(AHCIPort, fTrimEnabled);
@@ -1397,8 +1396,5 @@
     GEN_CHECK_OFF(AHCIPort, uATATransferMode);
     GEN_CHECK_OFF(AHCIPort, abATAPISense);
-    GEN_CHECK_OFF(AHCIPort, cNotifiedMediaChange);
     GEN_CHECK_OFF(AHCIPort, cLogSectorsPerPhysicalExp);
-    GEN_CHECK_OFF(AHCIPort, MediaEventStatus);
-    GEN_CHECK_OFF(AHCIPort, MediaTrackType);
     GEN_CHECK_OFF(AHCIPort, iLUN);
     GEN_CHECK_OFF(AHCIPort, u32TasksFinished);
@@ -1410,9 +1406,7 @@
     GEN_CHECK_OFF(AHCIPort, pDrvMedia);
     GEN_CHECK_OFF(AHCIPort, pDrvMediaEx);
-    GEN_CHECK_OFF(AHCIPort, pDrvMount);
     GEN_CHECK_OFF(AHCIPort, IBase);
     GEN_CHECK_OFF(AHCIPort, IPort);
     GEN_CHECK_OFF(AHCIPort, IMediaExPort);
-    GEN_CHECK_OFF(AHCIPort, IMountNotify);
     GEN_CHECK_OFF(AHCIPort, PCHSGeometry);
     GEN_CHECK_OFF(AHCIPort, Led);
@@ -1420,5 +1414,4 @@
 
     GEN_CHECK_OFF(AHCIPort, pTaskErr);
-    GEN_CHECK_OFF(AHCIPort, pTrackList);
     GEN_CHECK_OFF(AHCIPort, hEvtProcess);
     GEN_CHECK_OFF(AHCIPort, StatDMA);
@@ -1436,9 +1429,4 @@
     GEN_CHECK_OFF(AHCIPort, szModelNumber);
     GEN_CHECK_OFF(AHCIPort, szModelNumber[AHCI_MODEL_NUMBER_LENGTH]); /* One additional byte for the termination.*/
-    GEN_CHECK_OFF(AHCIPort, szInquiryVendorId[AHCI_ATAPI_INQUIRY_VENDOR_ID_LENGTH]);
-    GEN_CHECK_OFF(AHCIPort, szInquiryProductId);
-    GEN_CHECK_OFF(AHCIPort, szInquiryProductId[AHCI_ATAPI_INQUIRY_PRODUCT_ID_LENGTH]);
-    GEN_CHECK_OFF(AHCIPort, szInquiryRevision);
-    GEN_CHECK_OFF(AHCIPort, szInquiryRevision[AHCI_ATAPI_INQUIRY_REVISION_LENGTH]);
     GEN_CHECK_OFF(AHCIPort, cErrors);
     GEN_CHECK_OFF(AHCIPort, fRedo);
