VirtualBox

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


Ignore:
Timestamp:
Nov 12, 2019 10:54:37 AM (5 years ago)
Author:
vboxsync
Message:

DevFdc: Working on converting it to the new PDM device style. bugref:9218

File:
1 edited

Legend:

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

    r81591 r81794  
    653653    uint8_t irq_lvl;
    654654    uint8_t dma_chann;
    655     uint32_t io_base;
     655    uint16_t io_base;
    656656    /* Controller state */
    657657    struct TMTIMER *result_timer;
     
    22322232static DECLCALLBACK(int) fdcSaveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM)
    22332233{
    2234     fdctrl_t *pThis = PDMDEVINS_2_DATA(pDevIns, fdctrl_t *);
     2234    fdctrl_t     *pThis = PDMDEVINS_2_DATA(pDevIns, fdctrl_t *);
     2235    PCPDMDEVHLPR3 pHlp = pDevIns->pHlpR3;
    22352236    unsigned int i;
    22362237
    22372238    /* Save the FDC I/O registers... */
    2238     SSMR3PutU8(pSSM, pThis->sra);
    2239     SSMR3PutU8(pSSM, pThis->srb);
    2240     SSMR3PutU8(pSSM, pThis->dor);
    2241     SSMR3PutU8(pSSM, pThis->tdr);
    2242     SSMR3PutU8(pSSM, pThis->dsr);
    2243     SSMR3PutU8(pSSM, pThis->msr);
     2239    pHlp->pfnSSMPutU8(pSSM, pThis->sra);
     2240    pHlp->pfnSSMPutU8(pSSM, pThis->srb);
     2241    pHlp->pfnSSMPutU8(pSSM, pThis->dor);
     2242    pHlp->pfnSSMPutU8(pSSM, pThis->tdr);
     2243    pHlp->pfnSSMPutU8(pSSM, pThis->dsr);
     2244    pHlp->pfnSSMPutU8(pSSM, pThis->msr);
    22442245    /* ...the status registers... */
    2245     SSMR3PutU8(pSSM, pThis->status0);
    2246     SSMR3PutU8(pSSM, pThis->status1);
    2247     SSMR3PutU8(pSSM, pThis->status2);
     2246    pHlp->pfnSSMPutU8(pSSM, pThis->status0);
     2247    pHlp->pfnSSMPutU8(pSSM, pThis->status1);
     2248    pHlp->pfnSSMPutU8(pSSM, pThis->status2);
    22482249    /* ...the command FIFO... */
    2249     SSMR3PutU32(pSSM, sizeof(pThis->fifo));
    2250     SSMR3PutMem(pSSM, &pThis->fifo, sizeof(pThis->fifo));
    2251     SSMR3PutU32(pSSM, pThis->data_pos);
    2252     SSMR3PutU32(pSSM, pThis->data_len);
    2253     SSMR3PutU8(pSSM, pThis->data_state);
    2254     SSMR3PutU8(pSSM, pThis->data_dir);
     2250    pHlp->pfnSSMPutU32(pSSM, sizeof(pThis->fifo));
     2251    pHlp->pfnSSMPutMem(pSSM, &pThis->fifo, sizeof(pThis->fifo));
     2252    pHlp->pfnSSMPutU32(pSSM, pThis->data_pos);
     2253    pHlp->pfnSSMPutU32(pSSM, pThis->data_len);
     2254    pHlp->pfnSSMPutU8(pSSM, pThis->data_state);
     2255    pHlp->pfnSSMPutU8(pSSM, pThis->data_dir);
    22552256    /* ...and miscellaneous internal FDC state. */
    2256     SSMR3PutU8(pSSM, pThis->reset_sensei);
    2257     SSMR3PutU8(pSSM, pThis->eot);
    2258     SSMR3PutU8(pSSM, pThis->timer0);
    2259     SSMR3PutU8(pSSM, pThis->timer1);
    2260     SSMR3PutU8(pSSM, pThis->precomp_trk);
    2261     SSMR3PutU8(pSSM, pThis->config);
    2262     SSMR3PutU8(pSSM, pThis->lock);
    2263     SSMR3PutU8(pSSM, pThis->pwrd);
    2264     SSMR3PutU8(pSSM, pThis->version);
     2257    pHlp->pfnSSMPutU8(pSSM, pThis->reset_sensei);
     2258    pHlp->pfnSSMPutU8(pSSM, pThis->eot);
     2259    pHlp->pfnSSMPutU8(pSSM, pThis->timer0);
     2260    pHlp->pfnSSMPutU8(pSSM, pThis->timer1);
     2261    pHlp->pfnSSMPutU8(pSSM, pThis->precomp_trk);
     2262    pHlp->pfnSSMPutU8(pSSM, pThis->config);
     2263    pHlp->pfnSSMPutU8(pSSM, pThis->lock);
     2264    pHlp->pfnSSMPutU8(pSSM, pThis->pwrd);
     2265    pHlp->pfnSSMPutU8(pSSM, pThis->version);
    22652266
    22662267    /* Save the number of drives and per-drive state. Note that the media
    22672268     * states will be updated in fd_revalidate() and need not be saved.
    22682269     */
    2269     SSMR3PutU8(pSSM, pThis->num_floppies);
     2270    pHlp->pfnSSMPutU8(pSSM, pThis->num_floppies);
    22702271    Assert(RT_ELEMENTS(pThis->drives) == pThis->num_floppies);
    22712272    for (i = 0; i < pThis->num_floppies; ++i)
     
    22732274        fdrive_t *d = &pThis->drives[i];
    22742275
    2275         SSMR3PutMem(pSSM, &d->Led, sizeof(d->Led));
    2276         SSMR3PutU32(pSSM, d->drive);
    2277         SSMR3PutU8(pSSM, d->dsk_chg);
    2278         SSMR3PutU8(pSSM, d->perpendicular);
    2279         SSMR3PutU8(pSSM, d->head);
    2280         SSMR3PutU8(pSSM, d->track);
    2281         SSMR3PutU8(pSSM, d->sect);
     2276        pHlp->pfnSSMPutMem(pSSM, &d->Led, sizeof(d->Led));
     2277        pHlp->pfnSSMPutU32(pSSM, d->drive);
     2278        pHlp->pfnSSMPutU8(pSSM, d->dsk_chg);
     2279        pHlp->pfnSSMPutU8(pSSM, d->perpendicular);
     2280        pHlp->pfnSSMPutU8(pSSM, d->head);
     2281        pHlp->pfnSSMPutU8(pSSM, d->track);
     2282        pHlp->pfnSSMPutU8(pSSM, d->sect);
    22822283    }
    22832284    return TMR3TimerSave (pThis->result_timer, pSSM);
     
    22902291static DECLCALLBACK(int) fdcLoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass)
    22912292{
    2292     fdctrl_t *pThis = PDMDEVINS_2_DATA(pDevIns, fdctrl_t *);
     2293    fdctrl_t     *pThis = PDMDEVINS_2_DATA(pDevIns, fdctrl_t *);
     2294    PCPDMDEVHLPR3 pHlp = pDevIns->pHlpR3;
    22932295    unsigned int i;
    22942296    uint32_t val32;
    22952297    uint8_t val8;
     2298    int rc;
    22962299
    22972300    if (uVersion > FDC_SAVESTATE_CURRENT)
     
    23142317                        VERR_SSM_DATA_UNIT_FORMAT_CHANGED);
    23152318        /* Now load the old state. */
    2316         SSMR3GetU8(pSSM, &pThis->version);
     2319        pHlp->pfnSSMGetU8(pSSM, &pThis->version);
    23172320        /* Toss IRQ level, DMA channel, I/O base, and state. */
    2318         SSMR3GetU8(pSSM, &val8);
    2319         SSMR3GetU8(pSSM, &val8);
    2320         SSMR3GetU32(pSSM, &val32);
    2321         SSMR3GetU8(pSSM, &val8);
     2321        pHlp->pfnSSMGetU8(pSSM, &val8);
     2322        pHlp->pfnSSMGetU8(pSSM, &val8);
     2323        pHlp->pfnSSMGetU32(pSSM, &val32);
     2324        pHlp->pfnSSMGetU8(pSSM, &val8);
    23222325        /* Translate dma_en. */
    2323         SSMR3GetU8(pSSM, &val8);
     2326        rc = pHlp->pfnSSMGetU8(pSSM, &val8);
     2327        AssertRCReturn(rc, rc);
    23242328        if (val8)
    23252329            pThis->dor |= FD_DOR_DMAEN;
    2326         SSMR3GetU8(pSSM, &pThis->cur_drv);
     2330        pHlp->pfnSSMGetU8(pSSM, &pThis->cur_drv);
    23272331        /* Translate bootsel. */
    2328         SSMR3GetU8(pSSM, &val8);
     2332        rc = pHlp->pfnSSMGetU8(pSSM, &val8);
     2333        AssertRCReturn(rc, rc);
    23292334        pThis->tdr |= val8 << 2;
    2330         SSMR3GetMem(pSSM, &pThis->fifo, FD_SECTOR_LEN);
    2331         SSMR3GetU32(pSSM, &pThis->data_pos);
    2332         SSMR3GetU32(pSSM, &pThis->data_len);
    2333         SSMR3GetU8(pSSM, &pThis->data_state);
    2334         SSMR3GetU8(pSSM, &pThis->data_dir);
    2335         SSMR3GetU8(pSSM, &pThis->status0);
    2336         SSMR3GetU8(pSSM, &pThis->eot);
    2337         SSMR3GetU8(pSSM, &pThis->timer0);
    2338         SSMR3GetU8(pSSM, &pThis->timer1);
    2339         SSMR3GetU8(pSSM, &pThis->precomp_trk);
    2340         SSMR3GetU8(pSSM, &pThis->config);
    2341         SSMR3GetU8(pSSM, &pThis->lock);
    2342         SSMR3GetU8(pSSM, &pThis->pwrd);
     2335        pHlp->pfnSSMGetMem(pSSM, &pThis->fifo, FD_SECTOR_LEN);
     2336        pHlp->pfnSSMGetU32(pSSM, &pThis->data_pos);
     2337        pHlp->pfnSSMGetU32(pSSM, &pThis->data_len);
     2338        pHlp->pfnSSMGetU8(pSSM, &pThis->data_state);
     2339        pHlp->pfnSSMGetU8(pSSM, &pThis->data_dir);
     2340        pHlp->pfnSSMGetU8(pSSM, &pThis->status0);
     2341        pHlp->pfnSSMGetU8(pSSM, &pThis->eot);
     2342        pHlp->pfnSSMGetU8(pSSM, &pThis->timer0);
     2343        pHlp->pfnSSMGetU8(pSSM, &pThis->timer1);
     2344        pHlp->pfnSSMGetU8(pSSM, &pThis->precomp_trk);
     2345        pHlp->pfnSSMGetU8(pSSM, &pThis->config);
     2346        pHlp->pfnSSMGetU8(pSSM, &pThis->lock);
     2347        pHlp->pfnSSMGetU8(pSSM, &pThis->pwrd);
    23432348
    23442349        for (i = 0; i < 2; ++i)
     
    23462351            fdrive_t *d = &pThis->drives[i];
    23472352
    2348             SSMR3GetMem (pSSM, &d->Led, sizeof (d->Led));
    2349             SSMR3GetU32(pSSM, &val32);
     2353            pHlp->pfnSSMGetMem(pSSM, &d->Led, sizeof (d->Led));
     2354            rc = pHlp->pfnSSMGetU32(pSSM, &val32);
    23502355            d->drive = (fdrive_type_t)val32;
    2351             SSMR3GetU32(pSSM, &val32);    /* Toss drflags */
    2352             SSMR3GetU8(pSSM, &d->perpendicular);
    2353             SSMR3GetU8(pSSM, &d->head);
    2354             SSMR3GetU8(pSSM, &d->track);
    2355             SSMR3GetU8(pSSM, &d->sect);
    2356             SSMR3GetU8(pSSM, &val8);      /* Toss dir, rw */
    2357             SSMR3GetU8(pSSM, &val8);
    2358             SSMR3GetU32(pSSM, &val32);
     2356            AssertRCReturn(rc, rc);
     2357            pHlp->pfnSSMGetU32(pSSM, &val32);    /* Toss drflags */
     2358            pHlp->pfnSSMGetU8(pSSM, &d->perpendicular);
     2359            pHlp->pfnSSMGetU8(pSSM, &d->head);
     2360            pHlp->pfnSSMGetU8(pSSM, &d->track);
     2361            pHlp->pfnSSMGetU8(pSSM, &d->sect);
     2362            pHlp->pfnSSMGetU8(pSSM, &val8);      /* Toss dir, rw */
     2363            pHlp->pfnSSMGetU8(pSSM, &val8);
     2364            rc = pHlp->pfnSSMGetU32(pSSM, &val32);
     2365            AssertRCReturn(rc, rc);
    23592366            d->flags = (fdrive_flags_t)val32;
    2360             SSMR3GetU8(pSSM, &d->last_sect);
    2361             SSMR3GetU8(pSSM, &d->max_track);
    2362             SSMR3GetU16(pSSM, &d->bps);
    2363             SSMR3GetU8(pSSM, &d->ro);
     2367            pHlp->pfnSSMGetU8(pSSM, &d->last_sect);
     2368            pHlp->pfnSSMGetU8(pSSM, &d->max_track);
     2369            pHlp->pfnSSMGetU16(pSSM, &d->bps);
     2370            pHlp->pfnSSMGetU8(pSSM, &d->ro);
    23642371        }
    23652372    }
     
    23682375        Assert(uVersion == FDC_SAVESTATE_CURRENT);
    23692376        /* Load the FDC I/O registers... */
    2370         SSMR3GetU8(pSSM, &pThis->sra);
    2371         SSMR3GetU8(pSSM, &pThis->srb);
    2372         SSMR3GetU8(pSSM, &pThis->dor);
    2373         SSMR3GetU8(pSSM, &pThis->tdr);
    2374         SSMR3GetU8(pSSM, &pThis->dsr);
    2375         SSMR3GetU8(pSSM, &pThis->msr);
     2377        pHlp->pfnSSMGetU8(pSSM, &pThis->sra);
     2378        pHlp->pfnSSMGetU8(pSSM, &pThis->srb);
     2379        pHlp->pfnSSMGetU8(pSSM, &pThis->dor);
     2380        pHlp->pfnSSMGetU8(pSSM, &pThis->tdr);
     2381        pHlp->pfnSSMGetU8(pSSM, &pThis->dsr);
     2382        pHlp->pfnSSMGetU8(pSSM, &pThis->msr);
    23762383        /* ...the status registers... */
    2377         SSMR3GetU8(pSSM, &pThis->status0);
    2378         SSMR3GetU8(pSSM, &pThis->status1);
    2379         SSMR3GetU8(pSSM, &pThis->status2);
     2384        pHlp->pfnSSMGetU8(pSSM, &pThis->status0);
     2385        pHlp->pfnSSMGetU8(pSSM, &pThis->status1);
     2386        pHlp->pfnSSMGetU8(pSSM, &pThis->status2);
    23802387        /* ...the command FIFO, if the size matches... */
    2381         SSMR3GetU32(pSSM, &val32);
     2388        rc = pHlp->pfnSSMGetU32(pSSM, &val32);
     2389        AssertRCReturn(rc, rc);
    23822390        AssertMsgReturn(sizeof(pThis->fifo) == val32,
    23832391                        ("The size of FIFO in saved state doesn't match!\n"),
    23842392                        VERR_SSM_DATA_UNIT_FORMAT_CHANGED);
    2385         SSMR3GetMem(pSSM, &pThis->fifo, sizeof(pThis->fifo));
    2386         SSMR3GetU32(pSSM, &pThis->data_pos);
    2387         SSMR3GetU32(pSSM, &pThis->data_len);
    2388         SSMR3GetU8(pSSM, &pThis->data_state);
    2389         SSMR3GetU8(pSSM, &pThis->data_dir);
     2393        pHlp->pfnSSMGetMem(pSSM, &pThis->fifo, sizeof(pThis->fifo));
     2394        pHlp->pfnSSMGetU32(pSSM, &pThis->data_pos);
     2395        pHlp->pfnSSMGetU32(pSSM, &pThis->data_len);
     2396        pHlp->pfnSSMGetU8(pSSM, &pThis->data_state);
     2397        pHlp->pfnSSMGetU8(pSSM, &pThis->data_dir);
    23902398        /* ...and miscellaneous internal FDC state. */
    2391         SSMR3GetU8(pSSM, &pThis->reset_sensei);
    2392         SSMR3GetU8(pSSM, &pThis->eot);
    2393         SSMR3GetU8(pSSM, &pThis->timer0);
    2394         SSMR3GetU8(pSSM, &pThis->timer1);
    2395         SSMR3GetU8(pSSM, &pThis->precomp_trk);
    2396         SSMR3GetU8(pSSM, &pThis->config);
    2397         SSMR3GetU8(pSSM, &pThis->lock);
    2398         SSMR3GetU8(pSSM, &pThis->pwrd);
    2399         SSMR3GetU8(pSSM, &pThis->version);
     2399        pHlp->pfnSSMGetU8(pSSM, &pThis->reset_sensei);
     2400        pHlp->pfnSSMGetU8(pSSM, &pThis->eot);
     2401        pHlp->pfnSSMGetU8(pSSM, &pThis->timer0);
     2402        pHlp->pfnSSMGetU8(pSSM, &pThis->timer1);
     2403        pHlp->pfnSSMGetU8(pSSM, &pThis->precomp_trk);
     2404        pHlp->pfnSSMGetU8(pSSM, &pThis->config);
     2405        pHlp->pfnSSMGetU8(pSSM, &pThis->lock);
     2406        pHlp->pfnSSMGetU8(pSSM, &pThis->pwrd);
     2407        pHlp->pfnSSMGetU8(pSSM, &pThis->version);
    24002408
    24012409        /* Validate the number of drives. */
    2402         SSMR3GetU8(pSSM, &pThis->num_floppies);
     2410        rc = pHlp->pfnSSMGetU8(pSSM, &pThis->num_floppies);
     2411        AssertRCReturn(rc, rc);
    24032412        AssertMsgReturn(RT_ELEMENTS(pThis->drives) == pThis->num_floppies,
    24042413                        ("The number of drives in saved state doesn't match!\n"),
     
    24102419            fdrive_t *d = &pThis->drives[i];
    24112420
    2412             SSMR3GetMem(pSSM, &d->Led, sizeof(d->Led));
    2413             SSMR3GetU32(pSSM, &val32);
     2421            pHlp->pfnSSMGetMem(pSSM, &d->Led, sizeof(d->Led));
     2422            rc = pHlp->pfnSSMGetU32(pSSM, &val32);
     2423            AssertRCReturn(rc, rc);
    24142424            d->drive = (fdrive_type_t)val32;
    2415             SSMR3GetU8(pSSM, &d->dsk_chg);
    2416             SSMR3GetU8(pSSM, &d->perpendicular);
    2417             SSMR3GetU8(pSSM, &d->head);
    2418             SSMR3GetU8(pSSM, &d->track);
    2419             SSMR3GetU8(pSSM, &d->sect);
     2425            pHlp->pfnSSMGetU8(pSSM, &d->dsk_chg);
     2426            pHlp->pfnSSMGetU8(pSSM, &d->perpendicular);
     2427            pHlp->pfnSSMGetU8(pSSM, &d->head);
     2428            pHlp->pfnSSMGetU8(pSSM, &d->track);
     2429            pHlp->pfnSSMGetU8(pSSM, &d->sect);
    24202430        }
    24212431    }
    2422     return TMR3TimerLoad (pThis->result_timer, pSSM);
     2432    return TMR3TimerLoad(pThis->result_timer, pSSM);
    24232433}
    24242434
     
    26812691static DECLCALLBACK(int) fdcConstruct(PPDMDEVINS pDevIns, int iInstance, PCFGMNODE pCfg)
    26822692{
     2693    PDMDEV_CHECK_VERSIONS_RETURN(pDevIns);
     2694    fdctrl_t      *pThis = PDMDEVINS_2_DATA(pDevIns, fdctrl_t *);
     2695    PCPDMDEVHLPR3  pHlp  = pDevIns->pHlpR3;
     2696    int            rc;
     2697
    26832698    RT_NOREF(iInstance);
    2684     fdctrl_t      *pThis = PDMDEVINS_2_DATA(pDevIns, fdctrl_t *);
    2685     int            rc;
    2686     unsigned       i, j;
    2687     int            ii;
    2688     bool           mem_mapped;
    2689     uint16_t       io_base;
    2690     uint8_t        irq_lvl, dma_chann;
    2691     PPDMIBASE      pBase;
    2692 
    26932699    Assert(iInstance == 0);
    2694     PDMDEV_CHECK_VERSIONS_RETURN(pDevIns);
    26952700
    26962701    /*
    26972702     * Validate configuration.
    26982703     */
    2699     if (!CFGMR3AreValuesValid(pCfg, "IRQ\0DMA\0MemMapped\0IOBase\0"))
    2700         return VERR_PDM_DEVINS_UNKNOWN_CFG_VALUES;
     2704    PDMDEV_VALIDATE_CONFIG_RETURN(pDevIns, "IRQ|DMA|MemMapped|IOBase", "");
    27012705
    27022706    /*
    27032707     * Read the configuration.
    27042708     */
    2705     rc = CFGMR3QueryU8Def(pCfg, "IRQ", &irq_lvl, 6);
     2709    rc = pHlp->pfnCFGMQueryU8Def(pCfg, "IRQ", &pThis->irq_lvl, 6);
    27062710    AssertMsgRCReturn(rc, ("Configuration error: Failed to read U8 IRQ, rc=%Rrc\n", rc), rc);
    27072711
    2708     rc = CFGMR3QueryU8Def(pCfg, "DMA", &dma_chann, 2);
     2712    rc = pHlp->pfnCFGMQueryU8Def(pCfg, "DMA", &pThis->dma_chann, 2);
    27092713    AssertMsgRCReturn(rc, ("Configuration error: Failed to read U8 DMA, rc=%Rrc\n", rc), rc);
    27102714
    2711     rc = CFGMR3QueryU16Def(pCfg, "IOBase", &io_base, 0x3f0);
     2715    rc = pHlp->pfnCFGMQueryU16Def(pCfg, "IOBase", &pThis->io_base, 0x3f0);
    27122716    AssertMsgRCReturn(rc, ("Configuration error: Failed to read U16 IOBase, rc=%Rrc\n", rc), rc);
    27132717
    2714     rc = CFGMR3QueryBoolDef(pCfg, "MemMapped", &mem_mapped, false);
     2718    bool fMemMapped;
     2719    rc = pHlp->pfnCFGMQueryBoolDef(pCfg, "MemMapped", &fMemMapped, false);
    27152720    AssertMsgRCReturn(rc, ("Configuration error: Failed to read bool value MemMapped rc=%Rrc\n", rc), rc);
    27162721
     
    27182723     * Initialize data.
    27192724     */
    2720     LogFlow(("fdcConstruct: irq_lvl=%d dma_chann=%d io_base=%#x\n", irq_lvl, dma_chann, io_base));
     2725    LogFlow(("fdcConstruct: irq_lvl=%d dma_chann=%d io_base=%#x\n", pThis->irq_lvl, pThis->dma_chann, pThis->io_base));
    27212726    pThis->pDevIns   = pDevIns;
    27222727    pThis->version   = 0x90;   /* Intel 82078 controller */
    2723     pThis->irq_lvl   = irq_lvl;
    2724     pThis->dma_chann = dma_chann;
    2725     pThis->io_base   = io_base;
    27262728    pThis->config    = FD_CONFIG_EIS | FD_CONFIG_EFIFO; /* Implicit seek, polling & FIFO enabled */
    27272729    pThis->num_floppies = MAX_FD;
    27282730
    27292731    /* Fill 'command_to_handler' lookup table */
    2730     for (ii = RT_ELEMENTS(handlers) - 1; ii >= 0; ii--)
    2731         for (j = 0; j < sizeof(command_to_handler); j++)
     2732    for (int ii = RT_ELEMENTS(handlers) - 1; ii >= 0; ii--)
     2733        for (unsigned j = 0; j < sizeof(command_to_handler); j++)
    27322734            if ((j & handlers[ii].mask) == handlers[ii].value)
    27332735                command_to_handler[j] = ii;
     
    27362738    pThis->ILeds.pfnQueryStatusLed       = fdcStatusQueryStatusLed;
    27372739
    2738     for (i = 0; i < RT_ELEMENTS(pThis->drives); ++i)
     2740    for (unsigned i = 0; i < RT_ELEMENTS(pThis->drives); ++i)
    27392741    {
    27402742        fdrive_t *pDrv = &pThis->drives[i];
     
    27642766    if (pThis->dma_chann != 0xff)
    27652767    {
    2766         rc = PDMDevHlpDMARegister(pDevIns, dma_chann, &fdctrl_transfer_handler, pThis);
     2768        rc = PDMDevHlpDMARegister(pDevIns, pThis->dma_chann, &fdctrl_transfer_handler, pThis);
    27672769        if (RT_FAILURE(rc))
    27682770            return rc;
     
    27722774     * IO / MMIO.
    27732775     */
    2774     if (mem_mapped)
     2776    if (!fMemMapped)
    27752777    {
    2776         AssertMsgFailed(("Memory mapped floppy not support by now\n"));
    2777         return VERR_NOT_SUPPORTED;
    2778     }
    2779     else
    2780     {
    2781         rc = PDMDevHlpIOPortRegister(pDevIns, io_base + 0x1, 5, pThis,
     2778        rc = PDMDevHlpIOPortRegister(pDevIns, pThis->io_base + 0x1, 5, pThis,
    27822779                                     fdcIoPortWrite, fdcIoPortRead, NULL, NULL, "FDC#1");
    27832780        if (RT_FAILURE(rc))
    27842781            return rc;
    27852782
    2786         rc = PDMDevHlpIOPortRegister(pDevIns, io_base + 0x7, 1, pThis,
     2783        rc = PDMDevHlpIOPortRegister(pDevIns, pThis->io_base + 0x7, 1, pThis,
    27872784                                     fdcIoPortWrite, fdcIoPortRead, NULL, NULL, "FDC#2");
    27882785        if (RT_FAILURE(rc))
    27892786            return rc;
    27902787    }
     2788    else
     2789        AssertMsgFailedReturn(("Memory mapped floppy not support by now\n"), VERR_NOT_SUPPORTED);
    27912790
    27922791    /*
     
    28002799     * Attach the status port (optional).
    28012800     */
     2801    PPDMIBASE pBase;
    28022802    rc = PDMDevHlpDriverAttach(pDevIns, PDM_STATUS_LUN, &pThis->IBaseStatus, &pBase, "Status Port");
    28032803    if (RT_SUCCESS (rc))
    28042804        pThis->pLedsConnector = PDMIBASE_QUERY_INTERFACE(pBase, PDMILEDCONNECTORS);
    2805     else if (rc != VERR_PDM_NO_ATTACHED_DRIVER)
    2806     {
    2807         AssertMsgFailed(("Failed to attach to status driver. rc=%Rrc\n", rc));
    2808         return rc;
    2809     }
     2805    else
     2806        AssertMsgReturn(rc == VERR_PDM_NO_ATTACHED_DRIVER, ("Failed to attach to status driver. rc=%Rrc\n", rc), rc);
    28102807
    28112808    /*
    28122809     * Initialize drives.
    28132810     */
    2814     for (i = 0; i < RT_ELEMENTS(pThis->drives); i++)
     2811    for (unsigned i = 0; i < RT_ELEMENTS(pThis->drives); i++)
    28152812    {
    28162813        fdrive_t *pDrv = &pThis->drives[i];
     
    28262823    fdctrl_reset(pThis, 0);
    28272824
    2828     for (i = 0; i < RT_ELEMENTS(pThis->drives); i++)
     2825    for (unsigned i = 0; i < RT_ELEMENTS(pThis->drives); i++)
    28292826        fd_revalidate(&pThis->drives[i]);
    28302827
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