VirtualBox

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


Ignore:
Timestamp:
Aug 5, 2008 9:05:57 PM (16 years ago)
Author:
vboxsync
Message:

#1865: ATA and AHCI.

Location:
trunk/src/VBox/Devices/Storage
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Storage/ATAController.h

    r11143 r11144  
    3737#include "ide.h"
    3838
     39
     40/*******************************************************************************
     41*   Defined Constants And Macros                                               *
     42*******************************************************************************/
    3943/**
    4044 * Maximum number of sectors to transfer in a READ/WRITE MULTIPLE request.
     
    6165#define MAX_LOG_REL_ERRORS  1024
    6266
     67
     68/*******************************************************************************
     69*   Structures and Typedefs                                                    *
     70*******************************************************************************/
    6371typedef struct ATADevState {
    6472    /** Flag indicating whether the current command uses LBA48 mode. */
     
    154162    uint32_t cbIOBuffer;
    155163    /** Pointer to the I/O buffer. */
    156     R3R0PTRTYPE(uint8_t *) pbIOBufferHC;
     164    R3PTRTYPE(uint8_t *) pbIOBufferR3;
     165    /** Pointer to the I/O buffer. */
     166    R0PTRTYPE(uint8_t *) pbIOBufferR0;
    157167    /** Pointer to the I/O buffer. */
    158168    RCPTRTYPE(uint8_t *) pbIOBufferGC;
    159 #if HC_ARCH_BITS == 64
     169#if 1 /*HC_ARCH_BITS == 64*/
    160170    RTRCPTR Aligmnent0; /**< Align the statistics at an 8-byte boundrary. */
    161171#endif
     
    217227    RTUINT                          iLUN;
    218228#if HC_ARCH_BITS == 64
    219     RTUINT                          Alignment2; /**< Align pDevInsHC correctly. */
     229    RTUINT                          Alignment2; /**< Align pDevInsR3 correctly. */
    220230#endif
    221231    /** Pointer to device instance. */
    222     R3R0PTRTYPE(PPDMDEVINS)             pDevInsHC;
     232    PPDMDEVINSR3                        pDevInsR3;
    223233    /** Pointer to controller instance. */
    224     R3R0PTRTYPE(struct ATACONTROLLER *) pControllerHC;
    225     /** Pointer to device instance. */
    226     RCPTRTYPE(PPDMDEVINS)               pDevInsGC;
     234    R3PTRTYPE(struct ATACONTROLLER *)   pControllerR3;
     235    /** Pointer to device instance. */
     236    PPDMDEVINSR0                        pDevInsR0;
     237    /** Pointer to controller instance. */
     238    R0PTRTYPE(struct ATACONTROLLER *)   pControllerR0;
     239    /** Pointer to device instance. */
     240    PPDMDEVINSGC                        pDevInsGC;
    227241    /** Pointer to controller instance. */
    228242    RCPTRTYPE(struct ATACONTROLLER *)   pControllerGC;
     
    317331
    318332    /** Pointer to device instance. */
    319     R3R0PTRTYPE(PPDMDEVINS)         pDevInsHC;
    320     /** Pointer to device instance. */
    321     RCPTRTYPE(PPDMDEVINS)           pDevInsGC;
     333    PPDMDEVINSR3        pDevInsR3;
     334    /** Pointer to device instance. */
     335    PPDMDEVINSR0        pDevInsR0;
     336    /** Pointer to device instance. */
     337    PPDMDEVINSGC        pDevInsGC;
    322338
    323339    /** Set when the destroying the device instance and the thread must exit. */
     
    340356    /** The event semaphore the thread is waiting on during suspended I/O. */
    341357    RTSEMEVENT          SuspendIOSem;
    342 #if HC_ARCH_BITS == 32
     358#if 0 /*HC_ARCH_BITS == 32*/
    343359    uint32_t            Alignment0;
    344360#endif
    345361
    346362    /* Statistics */
    347     STAMCOUNTER StatAsyncOps;
    348     uint64_t    StatAsyncMinWait;
    349     uint64_t    StatAsyncMaxWait;
    350     STAMCOUNTER StatAsyncTimeUS;
    351     STAMPROFILEADV StatAsyncTime;
    352     STAMPROFILE StatLockWait;
     363    STAMCOUNTER     StatAsyncOps;
     364    uint64_t        StatAsyncMinWait;
     365    uint64_t        StatAsyncMaxWait;
     366    STAMCOUNTER     StatAsyncTimeUS;
     367    STAMPROFILEADV  StatAsyncTime;
     368    STAMPROFILE     StatLockWait;
    353369} ATACONTROLLER, *PATACONTROLLER;
    354370
    355 #define ATADEVSTATE_2_CONTROLLER(pIf)          ( (pIf)->CTXSUFF(pController) )
    356 #define ATADEVSTATE_2_DEVINS(pIf)              ( (pIf)->CTXSUFF(pDevIns) )
    357 #define CONTROLLER_2_DEVINS(pController)       ( (pController)->CTXSUFF(pDevIns) )
     371#ifndef VBOX_DEVICE_STRUCT_TESTCASE
     372
     373#define ATADEVSTATE_2_CONTROLLER(pIf)          ( (pIf)->CTXALLSUFF(pController) )
     374#define ATADEVSTATE_2_DEVINS(pIf)              ( (pIf)->CTXALLSUFF(pDevIns) )
     375#define CONTROLLER_2_DEVINS(pController)       ( (pController)->CTXALLSUFF(pDevIns) )
    358376#define PDMIBASE_2_ATASTATE(pInterface)        ( (ATADevState *)((uintptr_t)(pInterface) - RT_OFFSETOF(ATADevState, IBase)) )
    359377
    360 #ifndef VBOX_DEVICE_STRUCT_TESTCASE
     378
    361379/*******************************************************************************
    362380 *  Internal Functions                                                         *
  • trunk/src/VBox/Devices/Storage/DevATA.cpp

    r11143 r11144  
    1919 * additional information or have any questions.
    2020 */
     21
     22/*******************************************************************************
     23*   Defined Constants And Macros                                               *
     24*******************************************************************************/
     25/** Temporary instrumentation for tracking down potential virtual disk
     26 * write performance issues. */
     27#undef VBOX_INSTRUMENT_DMA_WRITES
     28
     29/**
     30 * The SSM saved state version.
     31 */
     32#define ATA_SAVED_STATE_VERSION 16
    2133
    2234
     
    4759#include "ATAController.h"
    4860#include "../Builtins.h"
    49 
    50 /**
    51  * The SSM saved state version.
    52  */
    53 #define ATA_SAVED_STATE_VERSION 16
    54 
    55 /** Temporary instrumentation for tracking down potential virtual disk
    56  * write performance issues. */
    57 #undef VBOX_INSTRUMENT_DMA_WRITES
    5861
    5962
     
    751754        RTStrPrintf(aSerial, sizeof(aSerial), "VB%08x-%08x", Uuid.au32[0], Uuid.au32[3]);
    752755
    753     p = (uint16_t *)s->CTXSUFF(pbIOBuffer);
     756    p = (uint16_t *)s->CTXALLSUFF(pbIOBuffer);
    754757    memset(p, 0, 512);
    755758    p[0] = RT_H2LE_U16(0x0040);
     
    875878        RTStrPrintf(aSerial, sizeof(aSerial), "VB%08x-%08x", Uuid.au32[0], Uuid.au32[3]);
    876879
    877     p = (uint16_t *)s->CTXSUFF(pbIOBuffer);
     880    p = (uint16_t *)s->CTXALLSUFF(pbIOBuffer);
    878881    memset(p, 0, 512);
    879882    /* Removable CDROM, 50us response, 12 byte packets */
     
    11181121    iLBA = ataGetSector(s);
    11191122    Log(("%s: %d sectors at LBA %d\n", __FUNCTION__, cSectors, iLBA));
    1120     rc = ataReadSectors(s, iLBA, s->CTXSUFF(pbIOBuffer), cSectors);
     1123    rc = ataReadSectors(s, iLBA, s->CTXALLSUFF(pbIOBuffer), cSectors);
    11211124    if (VBOX_SUCCESS(rc))
    11221125    {
     
    11651168    iLBA = ataGetSector(s);
    11661169    Log(("%s: %d sectors at LBA %d\n", __FUNCTION__, cSectors, iLBA));
    1167     rc = ataWriteSectors(s, iLBA, s->CTXSUFF(pbIOBuffer), cSectors);
     1170    rc = ataWriteSectors(s, iLBA, s->CTXALLSUFF(pbIOBuffer), cSectors);
    11681171    if (VBOX_SUCCESS(rc))
    11691172    {
     
    13401343    {
    13411344        case 2048:
    1342             rc = s->pDrvBlock->pfnRead(s->pDrvBlock, (uint64_t)s->iATAPILBA * s->cbATAPISector, s->CTXSUFF(pbIOBuffer), s->cbATAPISector * cSectors);
     1345            rc = s->pDrvBlock->pfnRead(s->pDrvBlock, (uint64_t)s->iATAPILBA * s->cbATAPISector, s->CTXALLSUFF(pbIOBuffer), s->cbATAPISector * cSectors);
    13431346            break;
    13441347        case 2352:
    13451348            {
    1346                 uint8_t *pbBuf = s->CTXSUFF(pbIOBuffer);
     1349                uint8_t *pbBuf = s->CTXALLSUFF(pbIOBuffer);
    13471350
    13481351                for (uint32_t i = s->iATAPILBA; i < s->iATAPILBA + cSectors; i++)
     
    14111414
    14121415    if (s->uTxDir == PDMBLOCKTXDIR_TO_DEVICE)
    1413         Log3(("ATAPI PT data write (%d): %.*Vhxs\n", cbTransfer, cbTransfer, s->CTXSUFF(pbIOBuffer)));
     1416        Log3(("ATAPI PT data write (%d): %.*Vhxs\n", cbTransfer, cbTransfer, s->CTXALLSUFF(pbIOBuffer)));
    14141417
    14151418    /* Simple heuristics: if there is at least one sector of data
     
    14401443        uint32_t iATAPILBA, cSectors, cReqSectors;
    14411444        size_t cbCurrTX;
    1442         uint8_t *pbBuf = s->CTXSUFF(pbIOBuffer);
     1445        uint8_t *pbBuf = s->CTXALLSUFF(pbIOBuffer);
    14431446
    14441447        switch (s->aATAPICmd[0])
     
    15141517    }
    15151518    else
    1516         rc = s->pDrvBlock->pfnSendCmd(s->pDrvBlock, s->aATAPICmd, (PDMBLOCKTXDIR)s->uTxDir, s->CTXSUFF(pbIOBuffer), &cbTransfer, &uATAPISenseKey, 30000 /**< @todo timeout */);
     1519        rc = s->pDrvBlock->pfnSendCmd(s->pDrvBlock, s->aATAPICmd, (PDMBLOCKTXDIR)s->uTxDir, s->CTXALLSUFF(pbIOBuffer), &cbTransfer, &uATAPISenseKey, 30000 /**< @todo timeout */);
    15171520    if (pProf) { STAM_PROFILE_ADV_STOP(pProf, b); }
    15181521
     
    15521555                 * Motivation: changing the VM configuration should be as
    15531556                 * invisible as possible to the guest. */
    1554                 Log3(("ATAPI PT inquiry data before (%d): %.*Vhxs\n", cbTransfer, cbTransfer, s->CTXSUFF(pbIOBuffer)));
    1555                 ataSCSIPadStr(s->CTXSUFF(pbIOBuffer) + 8, "VBOX", 8);
    1556                 ataSCSIPadStr(s->CTXSUFF(pbIOBuffer) + 16, "CD-ROM", 16);
    1557                 ataSCSIPadStr(s->CTXSUFF(pbIOBuffer) + 32, "1.0", 4);
     1557                Log3(("ATAPI PT inquiry data before (%d): %.*Vhxs\n", cbTransfer, cbTransfer, s->CTXALLSUFF(pbIOBuffer)));
     1558                ataSCSIPadStr(s->CTXALLSUFF(pbIOBuffer) + 8, "VBOX", 8);
     1559                ataSCSIPadStr(s->CTXALLSUFF(pbIOBuffer) + 16, "CD-ROM", 16);
     1560                ataSCSIPadStr(s->CTXALLSUFF(pbIOBuffer) + 32, "1.0", 4);
    15581561            }
    15591562            if (cbTransfer)
    1560                 Log3(("ATAPI PT data read (%d): %.*Vhxs\n", cbTransfer, cbTransfer, s->CTXSUFF(pbIOBuffer)));
     1563                Log3(("ATAPI PT data read (%d): %.*Vhxs\n", cbTransfer, cbTransfer, s->CTXALLSUFF(pbIOBuffer)));
    15611564        }
    15621565        s->iSourceSink = ATAFN_SS_NULL;
     
    16041607static bool atapiReadCapacitySS(ATADevState *s)
    16051608{
    1606     uint8_t *pbBuf = s->CTXSUFF(pbIOBuffer);
     1609    uint8_t *pbBuf = s->CTXALLSUFF(pbIOBuffer);
    16071610
    16081611    Assert(s->uTxDir == PDMBLOCKTXDIR_FROM_DEVICE);
     
    16181621static bool atapiReadDiscInformationSS(ATADevState *s)
    16191622{
    1620     uint8_t *pbBuf = s->CTXSUFF(pbIOBuffer);
     1623    uint8_t *pbBuf = s->CTXALLSUFF(pbIOBuffer);
    16211624
    16221625    Assert(s->uTxDir == PDMBLOCKTXDIR_FROM_DEVICE);
     
    16441647static bool atapiReadTrackInformationSS(ATADevState *s)
    16451648{
    1646     uint8_t *pbBuf = s->CTXSUFF(pbIOBuffer);
     1649    uint8_t *pbBuf = s->CTXALLSUFF(pbIOBuffer);
    16471650
    16481651    Assert(s->uTxDir == PDMBLOCKTXDIR_FROM_DEVICE);
     
    16731676static bool atapiGetConfigurationSS(ATADevState *s)
    16741677{
    1675     uint8_t *pbBuf = s->CTXSUFF(pbIOBuffer);
     1678    uint8_t *pbBuf = s->CTXALLSUFF(pbIOBuffer);
    16761679
    16771680    Assert(s->uTxDir == PDMBLOCKTXDIR_FROM_DEVICE);
     
    17081711static bool atapiInquirySS(ATADevState *s)
    17091712{
    1710     uint8_t *pbBuf = s->CTXSUFF(pbIOBuffer);
     1713    uint8_t *pbBuf = s->CTXALLSUFF(pbIOBuffer);
    17111714
    17121715    Assert(s->uTxDir == PDMBLOCKTXDIR_FROM_DEVICE);
     
    17361739static bool atapiModeSenseErrorRecoverySS(ATADevState *s)
    17371740{
    1738     uint8_t *pbBuf = s->CTXSUFF(pbIOBuffer);
     1741    uint8_t *pbBuf = s->CTXALLSUFF(pbIOBuffer);
    17391742
    17401743    Assert(s->uTxDir == PDMBLOCKTXDIR_FROM_DEVICE);
     
    17641767static bool atapiModeSenseCDStatusSS(ATADevState *s)
    17651768{
    1766     uint8_t *pbBuf = s->CTXSUFF(pbIOBuffer);
     1769    uint8_t *pbBuf = s->CTXALLSUFF(pbIOBuffer);
    17671770
    17681771    Assert(s->uTxDir == PDMBLOCKTXDIR_FROM_DEVICE);
     
    18121815static bool atapiRequestSenseSS(ATADevState *s)
    18131816{
    1814     uint8_t *pbBuf = s->CTXSUFF(pbIOBuffer);
     1817    uint8_t *pbBuf = s->CTXALLSUFF(pbIOBuffer);
    18151818
    18161819    Assert(s->uTxDir == PDMBLOCKTXDIR_FROM_DEVICE);
     
    18291832static bool atapiMechanismStatusSS(ATADevState *s)
    18301833{
    1831     uint8_t *pbBuf = s->CTXSUFF(pbIOBuffer);
     1834    uint8_t *pbBuf = s->CTXALLSUFF(pbIOBuffer);
    18321835
    18331836    Assert(s->uTxDir == PDMBLOCKTXDIR_FROM_DEVICE);
     
    18481851static bool atapiReadTOCNormalSS(ATADevState *s)
    18491852{
    1850     uint8_t *pbBuf = s->CTXSUFF(pbIOBuffer), *q, iStartTrack;
     1853    uint8_t *pbBuf = s->CTXALLSUFF(pbIOBuffer), *q, iStartTrack;
    18511854    bool fMSF;
    18521855    uint32_t cbSize;
     
    19101913static bool atapiReadTOCMultiSS(ATADevState *s)
    19111914{
    1912     uint8_t *pbBuf = s->CTXSUFF(pbIOBuffer);
     1915    uint8_t *pbBuf = s->CTXALLSUFF(pbIOBuffer);
    19131916    bool fMSF;
    19141917
     
    19421945static bool atapiReadTOCRawSS(ATADevState *s)
    19431946{
    1944     uint8_t *pbBuf = s->CTXSUFF(pbIOBuffer), *q, iStartTrack;
     1947    uint8_t *pbBuf = s->CTXALLSUFF(pbIOBuffer), *q, iStartTrack;
    19451948    bool fMSF;
    19461949    uint32_t cbSize;
     
    20342037
    20352038    pbPacket = s->aATAPICmd;
    2036     pbBuf = s->CTXSUFF(pbIOBuffer);
     2039    pbBuf = s->CTXALLSUFF(pbIOBuffer);
    20372040    switch (pbPacket[0])
    20382041    {
     
    23872390
    23882391    pbPacket = s->aATAPICmd;
    2389     pbBuf = s->CTXSUFF(pbIOBuffer);
     2392    pbBuf = s->CTXALLSUFF(pbIOBuffer);
    23902393    switch (pbPacket[0])
    23912394    {
     
    26762679{
    26772680    s->fDMA = !!(s->uATARegFeature & 1);
    2678     memcpy(s->aATAPICmd, s->CTXSUFF(pbIOBuffer), ATAPI_PACKET_SIZE);
     2681    memcpy(s->aATAPICmd, s->CTXALLSUFF(pbIOBuffer), ATAPI_PACKET_SIZE);
    26792682    s->uTxDir = PDMBLOCKTXDIR_NONE;
    26802683    s->cbTotalTransfer = 0;
     
    35153518    {
    35163519        Assert(s->uTxDir == PDMBLOCKTXDIR_TO_DEVICE);
    3517         p = s->CTXSUFF(pbIOBuffer) + s->iIOBufferPIODataStart;
     3520        p = s->CTXALLSUFF(pbIOBuffer) + s->iIOBufferPIODataStart;
    35183521#ifndef IN_RING3
    35193522        /* All but the last transfer unit is simple enough for GC, but
     
    35473550    {
    35483551        Assert(s->uTxDir == PDMBLOCKTXDIR_FROM_DEVICE);
    3549         p = s->CTXSUFF(pbIOBuffer) + s->iIOBufferPIODataStart;
     3552        p = s->CTXALLSUFF(pbIOBuffer) + s->iIOBufferPIODataStart;
    35503553#ifndef IN_RING3
    35513554        /* All but the last transfer unit is simple enough for GC, but
     
    36573660                       (int)pDesc, pBuffer, cbBuffer));
    36583661                if (uTxDir == PDMBLOCKTXDIR_FROM_DEVICE)
    3659                     PDMDevHlpPhysWrite(pDevIns, pBuffer, s->CTXSUFF(pbIOBuffer) + iIOBufferCur, dmalen);
     3662                    PDMDevHlpPhysWrite(pDevIns, pBuffer, s->CTXALLSUFF(pbIOBuffer) + iIOBufferCur, dmalen);
    36603663                else
    3661                     PDMDevHlpPhysRead(pDevIns, pBuffer, s->CTXSUFF(pbIOBuffer) + iIOBufferCur, dmalen);
     3664                    PDMDevHlpPhysRead(pDevIns, pBuffer, s->CTXALLSUFF(pbIOBuffer) + iIOBufferCur, dmalen);
    36623665                iIOBufferCur += dmalen;
    36633666                cbTotalTransfer -= dmalen;
     
    47134716#ifdef IN_GC
    47144717        for (uint32_t i = 0; i < cbTransfer; i += cb)
    4715             MMGCRamWriteNoTrapHandler((char *)GCDst + i, s->CTXSUFF(pbIOBuffer) + s->iIOBufferPIODataStart + i, cb);
     4718            MMGCRamWriteNoTrapHandler((char *)GCDst + i, s->CTXALLSUFF(pbIOBuffer) + s->iIOBufferPIODataStart + i, cb);
    47164719#else /* !IN_GC */
    4717         rc = PGMPhysWriteGCPtrDirty(PDMDevHlpGetVM(pDevIns), GCDst, s->CTXSUFF(pbIOBuffer) + s->iIOBufferPIODataStart, cbTransfer);
     4720        rc = PGMPhysWriteGCPtrDirty(PDMDevHlpGetVM(pDevIns), GCDst, s->CTXALLSUFF(pbIOBuffer) + s->iIOBufferPIODataStart, cbTransfer);
    47184721        Assert(rc == VINF_SUCCESS);
    47194722#endif /* IN_GC */
    47204723
    47214724        if (cbTransfer)
    4722             Log3(("%s: addr=%#x val=%.*Vhxs\n", __FUNCTION__, Port, cbTransfer, s->CTXSUFF(pbIOBuffer) + s->iIOBufferPIODataStart));
     4725            Log3(("%s: addr=%#x val=%.*Vhxs\n", __FUNCTION__, Port, cbTransfer, s->CTXALLSUFF(pbIOBuffer) + s->iIOBufferPIODataStart));
    47234726        s->iIOBufferPIODataStart += cbTransfer;
    47244727        *pGCPtrDst = (RTGCPTR)((RTGCUINTPTR)GCDst + cbTransfer);
     
    47704773#ifdef IN_GC
    47714774        for (uint32_t i = 0; i < cbTransfer; i += cb)
    4772             MMGCRamReadNoTrapHandler(s->CTXSUFF(pbIOBuffer) + s->iIOBufferPIODataStart + i, (char *)GCSrc + i, cb);
     4775            MMGCRamReadNoTrapHandler(s->CTXALLSUFF(pbIOBuffer) + s->iIOBufferPIODataStart + i, (char *)GCSrc + i, cb);
    47734776#else /* !IN_GC */
    4774         rc = PGMPhysReadGCPtr(PDMDevHlpGetVM(pDevIns), s->CTXSUFF(pbIOBuffer) + s->iIOBufferPIODataStart, GCSrc, cbTransfer);
     4777        rc = PGMPhysReadGCPtr(PDMDevHlpGetVM(pDevIns), s->CTXALLSUFF(pbIOBuffer) + s->iIOBufferPIODataStart, GCSrc, cbTransfer);
    47754778        Assert(rc == VINF_SUCCESS);
    47764779#endif /* IN_GC */
    47774780
    47784781        if (cbTransfer)
    4779             Log3(("%s: addr=%#x val=%.*Vhxs\n", __FUNCTION__, Port, cbTransfer, s->CTXSUFF(pbIOBuffer) + s->iIOBufferPIODataStart));
     4782            Log3(("%s: addr=%#x val=%.*Vhxs\n", __FUNCTION__, Port, cbTransfer, s->CTXALLSUFF(pbIOBuffer) + s->iIOBufferPIODataStart));
    47804783        s->iIOBufferPIODataStart += cbTransfer;
    47814784        *pGCPtrSrc = (RTGCPTR)((RTGCUINTPTR)GCSrc + cbTransfer);
     
    49054908DECLINLINE(void) ataRelocBuffer(PPDMDEVINS pDevIns, ATADevState *s)
    49064909{
    4907     if (s->pbIOBufferHC)
    4908         s->pbIOBufferGC = MMHyperHC2GC(PDMDevHlpGetVM(pDevIns), s->pbIOBufferHC);
     4910    if (s->pbIOBufferR3)
     4911        s->pbIOBufferGC = MMHyperR3ToGC(PDMDevHlpGetVM(pDevIns), s->pbIOBufferR3);
    49094912}
    49104913
     
    50885091        else
    50895092            AssertRelease(pIf->cbIOBuffer == ATA_MAX_MULT_SECTORS * 512);
    5090         Assert(pIf->pbIOBufferHC);
    5091         Assert(pIf->pbIOBufferGC == MMHyperHC2GC(pVM, pIf->pbIOBufferHC));
     5093        Assert(pIf->pbIOBufferR3);
     5094        Assert(pIf->pbIOBufferR0 == MMHyperR3ToR0(pVM, pIf->pbIOBufferR3));
     5095        Assert(pIf->pbIOBufferGC == MMHyperR3ToGC(pVM, pIf->pbIOBufferR3));
    50925096    }
    50935097    else
     
    50975101        else
    50985102            pIf->cbIOBuffer = ATA_MAX_MULT_SECTORS * 512;
    5099         Assert(!pIf->pbIOBufferHC);
    5100         rc = MMHyperAlloc(pVM, pIf->cbIOBuffer, 1, MM_TAG_PDM_DEVICE_USER, (void **)&pIf->pbIOBufferHC);
     5103        Assert(!pIf->pbIOBufferR3);
     5104        rc = MMHyperAlloc(pVM, pIf->cbIOBuffer, 1, MM_TAG_PDM_DEVICE_USER, (void **)&pIf->pbIOBufferR3);
    51015105        if (VBOX_FAILURE(rc))
    51025106            return VERR_NO_MEMORY;
    5103         pIf->pbIOBufferGC = MMHyperHC2GC(pVM, pIf->pbIOBufferHC);
     5107        pIf->pbIOBufferR0 = MMHyperR3ToR0(pVM, pIf->pbIOBufferR3);
     5108        pIf->pbIOBufferGC = MMHyperR3ToGC(pVM, pIf->pbIOBufferR3);
    51045109    }
    51055110
     
    53555360            SSMR3PutU32(pSSMHandle, pData->aCts[i].aIfs[j].cbIOBuffer);
    53565361            if (pData->aCts[i].aIfs[j].cbIOBuffer)
    5357                 SSMR3PutMem(pSSMHandle, pData->aCts[i].aIfs[j].CTXSUFF(pbIOBuffer), pData->aCts[i].aIfs[j].cbIOBuffer);
     5362                SSMR3PutMem(pSSMHandle, pData->aCts[i].aIfs[j].CTXALLSUFF(pbIOBuffer), pData->aCts[i].aIfs[j].cbIOBuffer);
    53585363            else
    5359                 Assert(pData->aCts[i].aIfs[j].CTXSUFF(pbIOBuffer) == NULL);
     5364                Assert(pData->aCts[i].aIfs[j].CTXALLSUFF(pbIOBuffer) == NULL);
    53605365        }
    53615366    }
     
    54615466            if (pData->aCts[i].aIfs[j].cbIOBuffer)
    54625467            {
    5463                 if (pData->aCts[i].aIfs[j].CTXSUFF(pbIOBuffer))
    5464                     SSMR3GetMem(pSSMHandle, pData->aCts[i].aIfs[j].CTXSUFF(pbIOBuffer), pData->aCts[i].aIfs[j].cbIOBuffer);
     5468                if (pData->aCts[i].aIfs[j].CTXALLSUFF(pbIOBuffer))
     5469                    SSMR3GetMem(pSSMHandle, pData->aCts[i].aIfs[j].CTXALLSUFF(pbIOBuffer), pData->aCts[i].aIfs[j].cbIOBuffer);
    54655470                else
    54665471                {
     
    54775482            }
    54785483            else
    5479                 Assert(pData->aCts[i].aIfs[j].CTXSUFF(pbIOBuffer) == NULL);
     5484                Assert(pData->aCts[i].aIfs[j].CTXALLSUFF(pbIOBuffer) == NULL);
    54805485        }
    54815486    }
     
    55955600    for (uint32_t i = 0; i < RT_ELEMENTS(pData->aCts); i++)
    55965601    {
    5597         pData->aCts[i].pDevInsHC = pDevIns;
     5602        pData->aCts[i].pDevInsR3 = pDevIns;
     5603        pData->aCts[i].pDevInsR0 = PDMDEVINS_2_R0PTR(pDevIns);
    55985604        pData->aCts[i].pDevInsGC = PDMDEVINS_2_GCPTR(pDevIns);
    55995605        pData->aCts[i].DelayIRQMillies = (uint32_t)DelayIRQMillies;
     
    56015607        {
    56025608            pData->aCts[i].aIfs[j].iLUN = i * RT_ELEMENTS(pData->aCts) + j;
    5603             pData->aCts[i].aIfs[j].pDevInsHC = pDevIns;
     5609            pData->aCts[i].aIfs[j].pDevInsR3 = pDevIns;
     5610            pData->aCts[i].aIfs[j].pDevInsR0 = PDMDEVINS_2_R0PTR(pDevIns);
    56045611            pData->aCts[i].aIfs[j].pDevInsGC = PDMDEVINS_2_GCPTR(pDevIns);
    5605             pData->aCts[i].aIfs[j].pControllerHC = &pData->aCts[i];
    5606             pData->aCts[i].aIfs[j].pControllerGC = MMHyperHC2GC(PDMDevHlpGetVM(pDevIns), &pData->aCts[i]);
     5612            pData->aCts[i].aIfs[j].pControllerR3 = &pData->aCts[i];
     5613            pData->aCts[i].aIfs[j].pControllerR0 = MMHyperR3ToR0(PDMDevHlpGetVM(pDevIns), &pData->aCts[i]);
     5614            pData->aCts[i].aIfs[j].pControllerGC = MMHyperR3ToGC(PDMDevHlpGetVM(pDevIns), &pData->aCts[i]);
    56075615            pData->aCts[i].aIfs[j].IBase.pfnQueryInterface = ataQueryInterface;
    56085616            pData->aCts[i].aIfs[j].IMountNotify.pfnMountNotify = ataMountNotify;
     
    57855793                pIf->pDrvBlock = NULL;
    57865794                pIf->cbIOBuffer = 0;
    5787                 pIf->pbIOBufferHC = NULL;
     5795                pIf->pbIOBufferR3 = NULL;
     5796                pIf->pbIOBufferR0 = NIL_RTR0PTR;
    57885797                pIf->pbIOBufferGC = NIL_RTGCPTR;
    57895798                LogRel(("PIIX3 ATA: LUN#%d: no unit\n", pIf->iLUN));
  • trunk/src/VBox/Devices/Storage/ide.h

    r8155 r11144  
     1/* $Id$ */
    12/** @file
    2  *
    3  * VBox storage devices:
    4  * ATA/ATAPI declarations
     3 * VBox storage devices: ATA/ATAPI declarations
    54 */
    65
     
    2120 */
    2221
    23 #ifndef __IDE_h__
    24 #define __IDE_h__
     22#ifndef ___Storage_IDE_h
     23#define ___Storage_IDE_h
    2524
    2625
     
    447446
    448447
    449 #endif /* __IDE_h__ */
     448#endif /* !___Storage_IDE_h */
     449
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