VirtualBox

Changeset 64176 in vbox


Ignore:
Timestamp:
Oct 7, 2016 10:06:26 AM (8 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
111159
Message:

AHCI: remove dead code

Location:
trunk/src/VBox/Devices
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Storage/DevAHCI.cpp

    r64141 r64176  
    6060#include "PIIX3ATABmDma.h"
    6161#include "ide.h"
    62 #include "ATAPIPassthrough.h"
    6362#include "VBoxDD.h"
    6463
     
    8079#define AHCI_NR_COMMAND_SLOTS   32
    8180
    82 #define AHCI_MAX_ALLOC_TOO_MUCH 20
    83 
    8481/** The current saved state version. */
    85 #define AHCI_SAVED_STATE_VERSION                        8
     82#define AHCI_SAVED_STATE_VERSION                        9
     83/** The saved state version before the ATAPI emulation was removed and the generic SCSI driver was used. */
     84#define AHCI_SAVED_STATE_VERSION_PRE_ATAPI_REMOVE       8
    8685/** The saved state version before changing the port reset logic in an incompatible way. */
    8786#define AHCI_SAVED_STATE_VERSION_PRE_PORT_RESET_CHANGES 7
     
    130129#define AHCI_FIRMWARE_REVISION_LENGTH         8
    131130#define AHCI_MODEL_NUMBER_LENGTH             40
    132 #define AHCI_ATAPI_INQUIRY_VENDOR_ID_LENGTH   8
    133 #define AHCI_ATAPI_INQUIRY_PRODUCT_ID_LENGTH 16
    134 #define AHCI_ATAPI_INQUIRY_REVISION_LENGTH    4
    135 
    136 /* MediaEventStatus */
    137 #define ATA_EVENT_STATUS_UNCHANGED              0    /**< medium event status not changed */
    138 #define ATA_EVENT_STATUS_MEDIA_NEW              1    /**< new medium inserted */
    139 #define ATA_EVENT_STATUS_MEDIA_REMOVED          2    /**< medium removed */
    140 #define ATA_EVENT_STATUS_MEDIA_CHANGED          3    /**< medium was removed + new medium was inserted */
    141 #define ATA_EVENT_STATUS_MEDIA_EJECT_REQUESTED  4    /**< medium eject requested (eject button pressed) */
    142 
    143 /* Media track type */
    144 #define ATA_MEDIA_TYPE_UNKNOWN                  0    /**< unknown CD type */
    145131
    146132/** ATAPI sense info size. */
     
    314300 * @implements PDMIMEDIAPORT
    315301 * @implements PDMIMEDIAEXPORT
    316  * @implements PDMIMOUNTNOTIFY
    317302 */
    318303typedef struct AHCIPort
     
    380365    /** Attached device is a CD/DVD drive. */
    381366    bool                            fATAPI;
    382     /** Passthrough SCSI commands. */
    383     bool                            fATAPIPassthrough;
    384367    /** Flag whether this port is in a reset state. */
    385368    volatile bool                   fPortReset;
     
    407390    /** ATAPI sense data. */
    408391    uint8_t                         abATAPISense[ATAPI_SENSE_SIZE];
    409     /** HACK: Countdown till we report a newly unmounted drive as mounted. */
    410     uint8_t                         cNotifiedMediaChange;
    411392    /** Exponent of logical sectors in a physical sector, number of logical sectors is 2^exp. */
    412393    uint8_t                         cLogSectorsPerPhysicalExp;
    413     /** The same for GET_EVENT_STATUS for mechanism */
    414     volatile uint32_t               MediaEventStatus;
    415     /** Media type if known. */
    416     volatile uint32_t               MediaTrackType;
    417394    /** The LUN. */
    418395    RTUINT                          iLUN;
     
    443420    /** Pointer to the attached driver's extended interface. */
    444421    R3PTRTYPE(PPDMIMEDIAEX)         pDrvMediaEx;
    445     /** Pointer to the attached driver's mount interface. */
    446     R3PTRTYPE(PPDMIMOUNT)           pDrvMount;
    447422    /** The base interface. */
    448423    PDMIBASE                        IBase;
     
    451426    /** The extended media port interface. */
    452427    PDMIMEDIAEXPORT                 IMediaExPort;
    453     /** The mount notify interface. */
    454     PDMIMOUNTNOTIFY                 IMountNotify;
    455428    /** Physical geometry of this image. */
    456429    PDMMEDIAGEOMETRY                PCHSGeometry;
     
    464437    /** First task throwing an error. */
    465438    R3PTRTYPE(volatile PAHCIREQ)    pTaskErr;
    466     /** The current tracklist of the loaded medium if passthrough is used. */
    467     R3PTRTYPE(PTRACKLIST)           pTrackList;
    468439
    469440    /** The event semaphore the processing thread waits on. */
     
    491462    /** The model number to use for IDENTIFY DEVICE commands. */
    492463    char                            szModelNumber[AHCI_MODEL_NUMBER_LENGTH+1]; /** < one extra byte for termination */
    493     /** The vendor identification string for SCSI INQUIRY commands. */
    494     char                            szInquiryVendorId[AHCI_ATAPI_INQUIRY_VENDOR_ID_LENGTH+1];
    495     /** The product identification string for SCSI INQUIRY commands. */
    496     char                            szInquiryProductId[AHCI_ATAPI_INQUIRY_PRODUCT_ID_LENGTH+1];
    497     /** The revision string for SCSI INQUIRY commands. */
    498     char                            szInquiryRevision[AHCI_ATAPI_INQUIRY_REVISION_LENGTH+1];
    499464    /** Error counter */
    500465    uint32_t                        cErrors;
     
    904869
    905870#define PCIDEV_2_PAHCI(pPciDev)                  ( (PAHCI)(pPciDev) )
    906 #define PDMIMOUNT_2_PAHCIPORT(pInterface)        ( (PAHCIPort)((uintptr_t)(pInterface) - RT_OFFSETOF(AHCIPort, IMount)) )
    907 #define PDMIMOUNTNOTIFY_2_PAHCIPORT(pInterface)  ( (PAHCIPort)((uintptr_t)(pInterface) - RT_OFFSETOF(AHCIPort, IMountNotify)) )
    908871#define PDMIBASE_2_PAHCIPORT(pInterface)         ( (PAHCIPort)((uintptr_t)(pInterface) - RT_OFFSETOF(AHCIPort, IBase)) )
    909872#define PDMIMEDIAPORT_2_PAHCIPORT(pInterface)    ( (PAHCIPort)((uintptr_t)(pInterface) - RT_OFFSETOF(AHCIPort, IPort)) )
     
    20341997    pAhciPort->u32CurrentCommandSlot = 0;
    20351998
    2036     ASMAtomicWriteU32(&pAhciPort->MediaEventStatus, ATA_EVENT_STATUS_UNCHANGED);
    2037     ASMAtomicWriteU32(&pAhciPort->MediaTrackType, ATA_MEDIA_TYPE_UNKNOWN);
    2038 
    20391999    if (pAhciPort->pDrvBase)
    20402000    {
     
    26552615    PDMIBASE_RETURN_INTERFACE(pszIID, PDMIMEDIAPORT, &pAhciPort->IPort);
    26562616    PDMIBASE_RETURN_INTERFACE(pszIID, PDMIMEDIAEXPORT, &pAhciPort->IMediaExPort);
    2657     PDMIBASE_RETURN_INTERFACE(pszIID, PDMIMOUNTNOTIFY, &pAhciPort->IMountNotify);
    26582617    return NULL;
    26592618}
     
    30933052
    30943053    /* Send a status good D2H FIS. */
    3095     ASMAtomicWriteU32(&pAhciPort->MediaEventStatus, ATA_EVENT_STATUS_UNCHANGED);
    30963054    pAhciPort->fResetDevice = false;
    30973055    if (pAhciPort->regCMD & AHCI_PORT_CMD_FRE)
     
    39013859                    ahciReqSetStatus(pAhciReq, 0, ATA_STAT_READY | ATA_STAT_SEEK);
    39023860                    pAhciReq->cmdFis[AHCI_CMDFIS_SECTN] = (pAhciReq->cmdFis[AHCI_CMDFIS_SECTN] & ~7)
    3903                         /*| ((pAhciReq->enmType != AHCITXDIR_WRITE) ? ATAPI_INT_REASON_IO : 0) @todo */
     3861                        | ((pAhciReq->fFlags & AHCI_REQ_XFER_2_HOST) ? ATAPI_INT_REASON_IO : 0)
    39043862                        | (!pAhciReq->cbTransfer ? ATAPI_INT_REASON_CD : 0);
    39053863                }
     
    39103868                                                          ATAPI_INT_REASON_IO | ATAPI_INT_REASON_CD;
    39113869                    pAhciReq->cbTransfer = 0;
     3870                    LogFlowFunc(("SCSI request completed with %u status\n", pAhciReq->u8ScsiSts));
    39123871                }
    39133872            }
     
    42424201                pAhciReq->cbTransfer = cbData;
    42434202                pAhciReq->cmdFis[AHCI_CMDFIS_SECTN] = (pAhciReq->cmdFis[AHCI_CMDFIS_SECTN] & ~7)
    4244                     /*| ((pAhciReq->enmTxDir != AHCITXDIR_WRITE) ? ATAPI_INT_REASON_IO : 0) @todo */
     4203                    | ((pAhciReq->fFlags & AHCI_REQ_XFER_2_HOST) ? ATAPI_INT_REASON_IO : 0)
    42454204                    | (!pAhciReq->cbTransfer ? ATAPI_INT_REASON_CD : 0);
    42464205
     
    50425001        SSMR3PutBool(pSSM, pThis->ahciPort[i].fATAPI);
    50435002        SSMR3PutMem(pSSM, &pThis->ahciPort[i].abATAPISense[0], sizeof(pThis->ahciPort[i].abATAPISense));
    5044         SSMR3PutU8(pSSM, pThis->ahciPort[i].cNotifiedMediaChange);
    5045         SSMR3PutU32(pSSM, pThis->ahciPort[i].MediaEventStatus);
    50465003    }
    50475004
     
    52875244                SSMR3GetBool(pSSM, &pThis->ahciPort[i].fATAPI);
    52885245                SSMR3GetMem(pSSM, pThis->ahciPort[i].abATAPISense, sizeof(pThis->ahciPort[i].abATAPISense));
    5289                 SSMR3GetU8(pSSM, &pThis->ahciPort[i].cNotifiedMediaChange);
    5290                 SSMR3GetU32(pSSM, (uint32_t*)&pThis->ahciPort[i].MediaEventStatus);
     5246                if (uVersion < AHCI_SAVED_STATE_VERSION_PRE_ATAPI_REMOVE)
     5247                {
     5248                    SSMR3Skip(pSSM, 1); /* cNotifiedMediaChange. */
     5249                    SSMR3Skip(pSSM, 4); /* MediaEventStatus */
     5250                }
    52915251            }
    52925252            else if (pThis->ahciPort[i].fATAPI)
     
    53715331                    VERR_PDM_MISSING_INTERFACE);
    53725332
    5373     pAhciPort->pDrvMount = PDMIBASE_QUERY_INTERFACE(pAhciPort->pDrvBase, PDMIMOUNT);
    5374 
    53755333    /*
    53765334     * Validate type.
     
    53805338                    ("AHCI configuration error: LUN#%d isn't a disk or cd/dvd. enmType=%u\n", pAhciPort->iLUN, enmType),
    53815339                    VERR_PDM_UNSUPPORTED_BLOCK_TYPE);
    5382     AssertMsgReturn(enmType == PDMMEDIATYPE_HARD_DISK || pAhciPort->pDrvMount,
    5383                     ("AHCI configuration error: LUN#%d is CD/DVD-ROM without a mountable interface\n", pAhciPort->iLUN),
    5384                     VERR_INTERNAL_ERROR);
    53855340
    53865341    int rc = pAhciPort->pDrvMediaEx->pfnIoReqAllocSizeSet(pAhciPort->pDrvMediaEx, sizeof(AHCIREQ));
     
    55985553        return PDMDEV_SET_ERROR(pDevIns, rc,
    55995554                    N_("AHCI configuration error: \"LogicalSectorsPerPhysical\" must be between 0 and 15"));
    5600 
    5601     /* There are three other identification strings for CD drives used for INQUIRY */
    5602     if (pAhciPort->fATAPI)
    5603     {
    5604         rc = CFGMR3QueryStringDef(pCfgNode, "ATAPIVendorId", pAhciPort->szInquiryVendorId, sizeof(pAhciPort->szInquiryVendorId),
    5605                                   "VBOX");
    5606         if (RT_FAILURE(rc))
    5607         {
    5608             if (rc == VERR_CFGM_NOT_ENOUGH_SPACE)
    5609                 return PDMDEV_SET_ERROR(pDevIns, VERR_INVALID_PARAMETER,
    5610                                 N_("AHCI configuration error: \"ATAPIVendorId\" is longer than 16 bytes"));
    5611             return PDMDEV_SET_ERROR(pDevIns, rc,
    5612                     N_("AHCI configuration error: failed to read \"ATAPIVendorId\" as string"));
    5613         }
    5614 
    5615         rc = CFGMR3QueryStringDef(pCfgNode, "ATAPIProductId", pAhciPort->szInquiryProductId, sizeof(pAhciPort->szInquiryProductId),
    5616                                   "CD-ROM");
    5617         if (RT_FAILURE(rc))
    5618         {
    5619             if (rc == VERR_CFGM_NOT_ENOUGH_SPACE)
    5620                 return PDMDEV_SET_ERROR(pDevIns, VERR_INVALID_PARAMETER,
    5621                                 N_("AHCI configuration error: \"ATAPIProductId\" is longer than 16 bytes"));
    5622             return PDMDEV_SET_ERROR(pDevIns, rc,
    5623                     N_("AHCI configuration error: failed to read \"ATAPIProductId\" as string"));
    5624         }
    5625 
    5626         rc = CFGMR3QueryStringDef(pCfgNode, "ATAPIRevision", pAhciPort->szInquiryRevision, sizeof(pAhciPort->szInquiryRevision),
    5627                                   "1.0");
    5628         if (RT_FAILURE(rc))
    5629         {
    5630             if (rc == VERR_CFGM_NOT_ENOUGH_SPACE)
    5631                 return PDMDEV_SET_ERROR(pDevIns, VERR_INVALID_PARAMETER,
    5632                                 N_("AHCI configuration error: \"ATAPIRevision\" is longer than 4 bytes"));
    5633             return PDMDEV_SET_ERROR(pDevIns, rc,
    5634                     N_("AHCI configuration error: failed to read \"ATAPIRevision\" as string"));
    5635         }
    5636     }
    56375555
    56385556    return rc;
  • trunk/src/VBox/Devices/testcase/tstDeviceStructSizeRC.cpp

    r64094 r64176  
    13851385    GEN_CHECK_OFF(AHCIPort, fFirstD2HFisSend);
    13861386    GEN_CHECK_OFF(AHCIPort, fATAPI);
    1387     GEN_CHECK_OFF(AHCIPort, fATAPIPassthrough);
    13881387    GEN_CHECK_OFF(AHCIPort, fPortReset);
    13891388    GEN_CHECK_OFF(AHCIPort, fTrimEnabled);
     
    13971396    GEN_CHECK_OFF(AHCIPort, uATATransferMode);
    13981397    GEN_CHECK_OFF(AHCIPort, abATAPISense);
    1399     GEN_CHECK_OFF(AHCIPort, cNotifiedMediaChange);
    14001398    GEN_CHECK_OFF(AHCIPort, cLogSectorsPerPhysicalExp);
    1401     GEN_CHECK_OFF(AHCIPort, MediaEventStatus);
    1402     GEN_CHECK_OFF(AHCIPort, MediaTrackType);
    14031399    GEN_CHECK_OFF(AHCIPort, iLUN);
    14041400    GEN_CHECK_OFF(AHCIPort, u32TasksFinished);
     
    14101406    GEN_CHECK_OFF(AHCIPort, pDrvMedia);
    14111407    GEN_CHECK_OFF(AHCIPort, pDrvMediaEx);
    1412     GEN_CHECK_OFF(AHCIPort, pDrvMount);
    14131408    GEN_CHECK_OFF(AHCIPort, IBase);
    14141409    GEN_CHECK_OFF(AHCIPort, IPort);
    14151410    GEN_CHECK_OFF(AHCIPort, IMediaExPort);
    1416     GEN_CHECK_OFF(AHCIPort, IMountNotify);
    14171411    GEN_CHECK_OFF(AHCIPort, PCHSGeometry);
    14181412    GEN_CHECK_OFF(AHCIPort, Led);
     
    14201414
    14211415    GEN_CHECK_OFF(AHCIPort, pTaskErr);
    1422     GEN_CHECK_OFF(AHCIPort, pTrackList);
    14231416    GEN_CHECK_OFF(AHCIPort, hEvtProcess);
    14241417    GEN_CHECK_OFF(AHCIPort, StatDMA);
     
    14361429    GEN_CHECK_OFF(AHCIPort, szModelNumber);
    14371430    GEN_CHECK_OFF(AHCIPort, szModelNumber[AHCI_MODEL_NUMBER_LENGTH]); /* One additional byte for the termination.*/
    1438     GEN_CHECK_OFF(AHCIPort, szInquiryVendorId[AHCI_ATAPI_INQUIRY_VENDOR_ID_LENGTH]);
    1439     GEN_CHECK_OFF(AHCIPort, szInquiryProductId);
    1440     GEN_CHECK_OFF(AHCIPort, szInquiryProductId[AHCI_ATAPI_INQUIRY_PRODUCT_ID_LENGTH]);
    1441     GEN_CHECK_OFF(AHCIPort, szInquiryRevision);
    1442     GEN_CHECK_OFF(AHCIPort, szInquiryRevision[AHCI_ATAPI_INQUIRY_REVISION_LENGTH]);
    14431431    GEN_CHECK_OFF(AHCIPort, cErrors);
    14441432    GEN_CHECK_OFF(AHCIPort, fRedo);
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette