VirtualBox

Changeset 49173 in vbox for trunk/src/VBox/Devices/Storage


Ignore:
Timestamp:
Oct 17, 2013 8:42:22 PM (12 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
90046
Message:

Storage/AHCI: Add per port hotplug configuration flag

File:
1 edited

Legend:

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

    r48744 r49173  
    8282
    8383/** The current saved state version. */
    84 #define AHCI_SAVED_STATE_VERSION                6
     84#define AHCI_SAVED_STATE_VERSION                   7
     85/** Saved state version before the per port hotplug port was added. */
     86#define AHCI_SAVED_STATE_VERSION_PRE_HOTPLUG_FLAG  6
    8587/** Saved state version before legacy ATA emulation was dropped. */
    86 #define AHCI_SAVED_STATE_VERSION_IDE_EMULATION  5
     88#define AHCI_SAVED_STATE_VERSION_IDE_EMULATION     5
    8789/** Saved state version before ATAPI support was added. */
    88 #define AHCI_SAVED_STATE_VERSION_PRE_ATAPI      3
     90#define AHCI_SAVED_STATE_VERSION_PRE_ATAPI         3
    8991/** The saved state version use in VirtualBox 3.0 and earlier.
    9092 * This was before the config was added and ahciIOTasks was dropped. */
    91 #define AHCI_SAVED_STATE_VERSION_VBOX_30        2
     93#define AHCI_SAVED_STATE_VERSION_VBOX_30           2
    9294/* for Older ATA state Read handling */
    9395#define ATA_CTL_SAVED_STATE_VERSION 3
     
    417419    uint32_t                        regCI;
    418420
    419 #if HC_ARCH_BITS == 64
    420     uint32_t                        Alignment1;
    421 #endif
    422 
     421    /** Current number of active tasks. */
     422    volatile uint32_t               cTasksActive;
    423423    /** Command List Base Address */
    424424    volatile RTGCPHYS               GCPhysAddrClb;
    425425    /** FIS Base Address */
    426426    volatile RTGCPHYS               GCPhysAddrFb;
    427     /** Current number of active tasks. */
    428     volatile uint32_t               cTasksActive;
    429427
    430428    /** Device is powered on. */
     
    446444    /** Flag if we are in a device reset. */
    447445    bool                            fResetDevice;
     446    /** Flag whether this port is hot plug capable. */
     447    bool                            fHotpluggable;
    448448    /** Flag whether the I/O thread idles. */
    449449    volatile bool                   fAsyncIOThreadIdle;
     
    452452    /** Flag whether the worker thread is sleeping. */
    453453    volatile bool                   fWrkThreadSleeping;
     454
     455    bool                            afAlignment[3];
    454456
    455457    /** Number of total sectors. */
     
    514516    PDMLED                          Led;
    515517
    516 #if HC_ARCH_BITS == 64
    517518    uint32_t                        u32Alignment3;
    518 #endif
    519519
    520520    /** Async IO Thread. */
     
    19341934    pAhciPort->regIE   = 0;
    19351935    pAhciPort->regCMD  = AHCI_PORT_CMD_CPD  | /* Cold presence detection */
    1936                          AHCI_PORT_CMD_HPCP | /* Hotplugging supported. */
    19371936                         AHCI_PORT_CMD_SUD  | /* Device has spun up. */
    19381937                         AHCI_PORT_CMD_POD;   /* Port is powered on. */
     1938
     1939    /* Hotplugging supported?. */
     1940    if (pAhciPort->fHotpluggable)
     1941        pAhciPort->regCMD |= AHCI_PORT_CMD_HPCP;
     1942
    19391943    pAhciPort->regTFD  = (1 << 8) | ATA_STAT_SEEK | ATA_STAT_WRERR;
    19401944    pAhciPort->regSIG  = ~0;
     
    67906794    {
    67916795        SSMR3PutBool(pSSM, pThis->ahciPort[i].pDrvBase != NULL);
     6796        SSMR3PutBool(pSSM, pThis->ahciPort[i].fHotpluggable);
    67926797        SSMR3PutStrZ(pSSM, pThis->ahciPort[i].szSerialNumber);
    67936798        SSMR3PutStrZ(pSSM, pThis->ahciPort[i].szFirmwareRevision);
     
    69946999                                        fInUse ? "target" : "source", i );
    69957000
     7001            if (uVersion > AHCI_SAVED_STATE_VERSION_PRE_HOTPLUG_FLAG)
     7002            {
     7003                bool fHotpluggable;
     7004                rc = SSMR3GetBool(pSSM, &fHotpluggable);
     7005                AssertRCReturn(rc, rc);
     7006                if (fHotpluggable != pThis->ahciPort[i].fHotpluggable)
     7007                    return SSMR3SetCfgError(pSSM, RT_SRC_POS,
     7008                                            N_("AHCI: Port %u config mismatch: Hotplug flag - saved=%RTbool config=%RTbool\n"),
     7009                                            i, fHotpluggable, pThis->ahciPort[i].fHotpluggable);
     7010            }
     7011            else
     7012                Assert(pThis->ahciPort[i].fHotpluggable);
     7013
    69967014            char szSerialNumber[AHCI_SERIAL_NUMBER_LENGTH+1];
    69977015            rc = SSMR3GetStrZ(pSSM, szSerialNumber,     sizeof(szSerialNumber));
     
    75777595
    75787596    AssertMsg(iLUN < pAhci->cPortsImpl, ("iLUN=%u", iLUN));
     7597    AssertMsgReturnVoid(   pAhciPort->fHotpluggable
     7598                        || (fFlags & PDM_TACH_FLAGS_NOT_HOT_PLUG),
     7599                        ("AHCI: Port %d is not marked hotpluggable\n", pAhciPort->iLUN));
     7600
    75797601
    75807602    if (pAhciPort->pAsyncIOThread)
     
    76937715            && !(fFlags & PDM_TACH_FLAGS_NOT_HOT_PLUG))
    76947716        {
     7717            AssertMsgReturn(pAhciPort->fHotpluggable,
     7718                            ("AHCI: Port %d is not marked hotpluggable\n", pAhciPort->iLUN),
     7719                            VERR_NOT_SUPPORTED);
     7720
    76957721            /*
    76967722             * Initialize registers
     
    81188144        pAhciPort->IMountNotify.pfnUnmountNotify        = ahciR3UnmountNotify;
    81198145        pAhciPort->fAsyncIOThreadIdle                   = true;
     8146
     8147        /* Query per port configuration options if available. */
     8148        PCFGMNODE pCfgPort = CFGMR3GetChild(pDevIns->pCfg, szName);
     8149        if (pCfgPort)
     8150        {
     8151            rc = CFGMR3QueryBoolDef(pCfgPort, "Hotpluggable", &pAhciPort->fHotpluggable, true);
     8152            if (RT_FAILURE(rc))
     8153                return PDMDEV_SET_ERROR(pDevIns, rc,
     8154                                        N_("AHCI configuration error: failed to read Hotpluggable as boolean"));
     8155        }
    81208156
    81218157        /*
Note: See TracChangeset for help on using the changeset viewer.

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