VirtualBox

Changeset 32879 in vbox


Ignore:
Timestamp:
Oct 4, 2010 8:40:38 AM (14 years ago)
Author:
vboxsync
Message:

AHCI: Clear status and error fields of a task for the async I/O case for every new command, fixes booting newer Solaris guests. Don't process the ATA command if the Control bit is set in the FIS.

File:
1 edited

Legend:

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

    r32723 r32879  
    59285928        case ATA_SMART:
    59295929        case ATA_NV_CACHE:
     5930        case ATA_IDLE:
    59305931            pAhciPortTaskState->uATARegError = ABRT_ERR;
    59315932            pAhciPortTaskState->uATARegStatus = ATA_STAT_READY | ATA_STAT_ERR;
     
    60696070        AssertMsg(fXchg, ("Task is already active\n"));
    60706071#endif
     6072
     6073        pAhciPortTaskState->uATARegStatus = 0;
     6074        pAhciPortTaskState->uATARegError  = 0;
    60716075
    60726076        /** Set current command slot */
     
    61156119            }
    61166120        }
    6117 
    6118         enmTxDir = ahciProcessCmd(pAhciPort, pAhciPortTaskState, pAhciPortTaskState->cmdFis);
    6119 
    6120         if (enmTxDir != AHCITXDIR_NONE)
    6121         {
    6122             pAhciPortTaskState->enmTxDir = enmTxDir;
    6123 
    6124             ahciLog(("%s: Before increment uActTasksActive=%u\n", __FUNCTION__, pAhciPort->uActTasksActive));
    6125             ASMAtomicIncU32(&pAhciPort->uActTasksActive);
    6126             ahciLog(("%s: After increment uActTasksActive=%u\n", __FUNCTION__, pAhciPort->uActTasksActive));
    6127 
    6128             if (enmTxDir != AHCITXDIR_FLUSH)
     6121        else
     6122        {
     6123            enmTxDir = ahciProcessCmd(pAhciPort, pAhciPortTaskState, pAhciPortTaskState->cmdFis);
     6124
     6125            if (enmTxDir != AHCITXDIR_NONE)
    61296126            {
    6130                 STAM_REL_COUNTER_INC(&pAhciPort->StatDMA);
    6131 
    6132                 rc = ahciScatterGatherListCreate(pAhciPort, pAhciPortTaskState, (enmTxDir == AHCITXDIR_READ) ? false : true);
    6133                 if (RT_FAILURE(rc))
    6134                     AssertMsgFailed(("%s: Failed to process command %Rrc\n", __FUNCTION__, rc));
    6135             }
    6136 
    6137             if (enmTxDir == AHCITXDIR_FLUSH)
    6138             {
    6139                 rc = pAhciPort->pDrvBlockAsync->pfnStartFlush(pAhciPort->pDrvBlockAsync,
    6140                                                               pAhciPortTaskState);
    6141             }
    6142             else if (enmTxDir == AHCITXDIR_READ)
    6143             {
    6144                 pAhciPort->Led.Asserted.s.fReading = pAhciPort->Led.Actual.s.fReading = 1;
    6145                 rc = pAhciPort->pDrvBlockAsync->pfnStartRead(pAhciPort->pDrvBlockAsync, pAhciPortTaskState->uOffset,
    6146                                                              pAhciPortTaskState->pSGListHead, pAhciPortTaskState->cSGListUsed,
    6147                                                              pAhciPortTaskState->cbTransfer,
    6148                                                              pAhciPortTaskState);
     6127                pAhciPortTaskState->enmTxDir = enmTxDir;
     6128
     6129                ahciLog(("%s: Before increment uActTasksActive=%u\n", __FUNCTION__, pAhciPort->uActTasksActive));
     6130                ASMAtomicIncU32(&pAhciPort->uActTasksActive);
     6131                ahciLog(("%s: After increment uActTasksActive=%u\n", __FUNCTION__, pAhciPort->uActTasksActive));
     6132
     6133                if (enmTxDir != AHCITXDIR_FLUSH)
     6134                {
     6135                    STAM_REL_COUNTER_INC(&pAhciPort->StatDMA);
     6136
     6137                    rc = ahciScatterGatherListCreate(pAhciPort, pAhciPortTaskState, (enmTxDir == AHCITXDIR_READ) ? false : true);
     6138                    if (RT_FAILURE(rc))
     6139                        AssertMsgFailed(("%s: Failed to process command %Rrc\n", __FUNCTION__, rc));
     6140                }
     6141
     6142                if (enmTxDir == AHCITXDIR_FLUSH)
     6143                {
     6144                    rc = pAhciPort->pDrvBlockAsync->pfnStartFlush(pAhciPort->pDrvBlockAsync,
     6145                                                                  pAhciPortTaskState);
     6146                }
     6147                else if (enmTxDir == AHCITXDIR_READ)
     6148                {
     6149                    pAhciPort->Led.Asserted.s.fReading = pAhciPort->Led.Actual.s.fReading = 1;
     6150                    rc = pAhciPort->pDrvBlockAsync->pfnStartRead(pAhciPort->pDrvBlockAsync, pAhciPortTaskState->uOffset,
     6151                                                                 pAhciPortTaskState->pSGListHead, pAhciPortTaskState->cSGListUsed,
     6152                                                                 pAhciPortTaskState->cbTransfer,
     6153                                                                 pAhciPortTaskState);
     6154                }
     6155                else
     6156                {
     6157                    pAhciPort->Led.Asserted.s.fWriting = pAhciPort->Led.Actual.s.fWriting = 1;
     6158                    rc = pAhciPort->pDrvBlockAsync->pfnStartWrite(pAhciPort->pDrvBlockAsync, pAhciPortTaskState->uOffset,
     6159                                                                  pAhciPortTaskState->pSGListHead, pAhciPortTaskState->cSGListUsed,
     6160                                                                  pAhciPortTaskState->cbTransfer,
     6161                                                                  pAhciPortTaskState);
     6162                }
     6163                if (rc == VINF_VD_ASYNC_IO_FINISHED)
     6164                    rc = ahciTransferComplete(pAhciPort, pAhciPortTaskState, VINF_SUCCESS);
     6165
     6166                if (RT_FAILURE(rc) && rc != VERR_VD_ASYNC_IO_IN_PROGRESS)
     6167                    rc = ahciTransferComplete(pAhciPort, pAhciPortTaskState, rc);
    61496168            }
    61506169            else
    61516170            {
    6152                 pAhciPort->Led.Asserted.s.fWriting = pAhciPort->Led.Actual.s.fWriting = 1;
    6153                 rc = pAhciPort->pDrvBlockAsync->pfnStartWrite(pAhciPort->pDrvBlockAsync, pAhciPortTaskState->uOffset,
    6154                                                               pAhciPortTaskState->pSGListHead, pAhciPortTaskState->cSGListUsed,
    6155                                                               pAhciPortTaskState->cbTransfer,
    6156                                                               pAhciPortTaskState);
     6171#ifdef RT_STRICT
     6172                fXchg = ASMAtomicCmpXchgBool(&pAhciPortTaskState->fActive, false, true);
     6173                AssertMsg(fXchg, ("Task is not active\n"));
     6174#endif
     6175
     6176                /* There is nothing left to do. Notify the guest. */
     6177                ahciSendD2HFis(pAhciPort, pAhciPortTaskState, &pAhciPortTaskState->cmdFis[0], true);
     6178                /* Add the task to the cache. */
     6179                pAhciPort->aCachedTasks[pAhciPortTaskState->uTag] = pAhciPortTaskState;
    61576180            }
    6158             if (rc == VINF_VD_ASYNC_IO_FINISHED)
    6159                 rc = ahciTransferComplete(pAhciPort, pAhciPortTaskState, VINF_SUCCESS);
    6160 
    6161             if (RT_FAILURE(rc) && rc != VERR_VD_ASYNC_IO_IN_PROGRESS)
    6162                 rc = ahciTransferComplete(pAhciPort, pAhciPortTaskState, rc);
    6163         }
    6164         else
    6165         {
    6166 #ifdef RT_STRICT
    6167             fXchg = ASMAtomicCmpXchgBool(&pAhciPortTaskState->fActive, false, true);
    6168             AssertMsg(fXchg, ("Task is not active\n"));
    6169 #endif
    6170 
    6171             /* There is nothing left to do. Notify the guest. */
    6172             ahciSendD2HFis(pAhciPort, pAhciPortTaskState, &pAhciPortTaskState->cmdFis[0], true);
    6173             /* Add the task to the cache. */
    6174             pAhciPort->aCachedTasks[pAhciPortTaskState->uTag] = pAhciPortTaskState;
    61756181        }
    61766182    }
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