VirtualBox

Changeset 51340 in vbox


Ignore:
Timestamp:
May 22, 2014 9:17:55 AM (11 years ago)
Author:
vboxsync
Message:

Storage/AHCI: Revert to the legacy port reset method if we loaded a saved state

File:
1 edited

Legend:

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

    r51232 r51340  
    8282
    8383/** The current saved state version. */
    84 #define AHCI_SAVED_STATE_VERSION                   7
     84#define AHCI_SAVED_STATE_VERSION                        8
     85/** The saved state version before changing the port reset logic in an incomptible way. */
     86#define AHCI_SAVED_STATE_VERSION_PRE_PORT_RESET_CHANGES 7
    8587/** Saved state version before the per port hotplug port was added. */
    86 #define AHCI_SAVED_STATE_VERSION_PRE_HOTPLUG_FLAG  6
     88#define AHCI_SAVED_STATE_VERSION_PRE_HOTPLUG_FLAG       6
    8789/** Saved state version before legacy ATA emulation was dropped. */
    88 #define AHCI_SAVED_STATE_VERSION_IDE_EMULATION     5
     90#define AHCI_SAVED_STATE_VERSION_IDE_EMULATION          5
    8991/** Saved state version before ATAPI support was added. */
    90 #define AHCI_SAVED_STATE_VERSION_PRE_ATAPI         3
     92#define AHCI_SAVED_STATE_VERSION_PRE_ATAPI              3
    9193/** The saved state version use in VirtualBox 3.0 and earlier.
    9294 * This was before the config was added and ahciIOTasks was dropped. */
    93 #define AHCI_SAVED_STATE_VERSION_VBOX_30           2
     95#define AHCI_SAVED_STATE_VERSION_VBOX_30                2
    9496/* for Older ATA state Read handling */
    9597#define ATA_CTL_SAVED_STATE_VERSION 3
     
    692694    /** Flag whether the controller has BIOS access enabled. */
    693695    bool                            fBootable;
     696    /** Flag whether the legacy port reset method should be used to make it work with saved states. */
     697    bool                            fLegacyPortResetMethod;
    694698
    695699    /** Number of usable ports on this controller. */
     
    12591263             && pAhciPort->pDrvBase)
    12601264    {
    1261         pAhciPort->regSCTL = u32Value;  /* Update before kicking the I/O thread. */
    1262         pAhciPort->regSSTS = 0x1; /* Indicate device presence detected but communication not established. */
    1263 
    1264         /* Kick the thread to finish the reset. */
    1265         ahciIoThreadKick(ahci, pAhciPort);
     1265        /* Do the port reset here, so the guest sees the new status immediately. */
     1266        if (ahci->fLegacyPortResetMethod)
     1267        {
     1268            ahciPortResetFinish(pAhciPort);
     1269            pAhciPort->regSCTL = u32Value; /* Update after finishing the reset, so the I/O thread doesn't get a chance to do the reset. */
     1270        }
     1271        else
     1272        {
     1273            pAhciPort->regSSTS = 0x1; /* Indicate device presence detected but communication not established. */
     1274            pAhciPort->regSCTL = u32Value;  /* Update before kicking the I/O thread. */
     1275
     1276            /* Kick the thread to finish the reset. */
     1277            ahciIoThreadKick(ahci, pAhciPort);
     1278        }
    12661279    }
    12671280
     
    69776990    SSMR3PutBool(pSSM, pThis->fR0Enabled);
    69786991    SSMR3PutBool(pSSM, pThis->fGCEnabled);
     6992    SSMR3PutBool(pSSM, pThis->fLegacyPortResetMethod);
    69796993
    69806994    /* Now every port. */
     
    71087122        uVersion++;
    71097123
     7124    /*
     7125     * Check whether we have to resort to the legacy port reset method to
     7126     * prevent older BIOS versions from failing after a reset.
     7127     */
     7128    if (uVersion < AHCI_SAVED_STATE_VERSION_PRE_PORT_RESET_CHANGES)
     7129        pThis->fLegacyPortResetMethod = true;
     7130
    71107131    /* Verify config. */
    71117132    if (uVersion > AHCI_SAVED_STATE_VERSION_VBOX_30)
     
    72067227        SSMR3GetBool(pSSM, &pThis->fR0Enabled);
    72077228        SSMR3GetBool(pSSM, &pThis->fGCEnabled);
     7229        if (uVersion > AHCI_SAVED_STATE_VERSION_PRE_PORT_RESET_CHANGES)
     7230            SSMR3GetBool(pSSM, &pThis->fLegacyPortResetMethod);
    72087231
    72097232        /* Now every port. */
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