VirtualBox

Changeset 81995 in vbox


Ignore:
Timestamp:
Nov 19, 2019 1:46:52 PM (5 years ago)
Author:
vboxsync
Message:

DevFDC: Added option for enabling access to status register A (SRA) - PS/2++ not org PC. bugref:9218

File:
1 edited

Legend:

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

    r81799 r81995  
    692692    PPDMILEDCONNECTORS pLedsConnector;
    693693
     694    /** I/O ports: 0x3f0 */
     695    IOMIOPORTHANDLE hIoPorts0;
    694696    /** I/O ports: 0x3f1..0x3f5 */
    695697    IOMIOPORTHANDLE hIoPorts1;
     
    21852187
    21862188/**
    2187  * @callback_method_impl{FNIOMIOPORTNEWOUT, Handling 0x3f1..0x3f5 acceses.}
     2189 * @callback_method_impl{FNIOMIOPORTNEWOUT, Handling 0x3f0 accesses.}
     2190 */
     2191static DECLCALLBACK(VBOXSTRICTRC) fdcIoPort0Write(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT offPort, uint32_t u32, unsigned cb)
     2192{
     2193    RT_NOREF(pvUser);
     2194
     2195    if (cb == 1)
     2196        fdctrl_write(PDMDEVINS_2_DATA(pDevIns, fdctrl_t *), offPort, u32);
     2197    else
     2198        ASSERT_GUEST_MSG_FAILED(("offPort=%#x cb=%d u32=%#x\n", offPort, cb, u32));
     2199    return VINF_SUCCESS;
     2200}
     2201
     2202
     2203/**
     2204 * @callback_method_impl{FNIOMIOPORTNEWIN, Handling 0x3f0 accesses.}
     2205 */
     2206static DECLCALLBACK(VBOXSTRICTRC) fdcIoPort0Read(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT offPort, uint32_t *pu32, unsigned cb)
     2207{
     2208    RT_NOREF(pvUser);
     2209
     2210    if (cb == 1)
     2211    {
     2212        *pu32 = fdctrl_read(PDMDEVINS_2_DATA(pDevIns, fdctrl_t *), offPort);
     2213        return VINF_SUCCESS;
     2214    }
     2215    return VERR_IOM_IOPORT_UNUSED;
     2216}
     2217
     2218
     2219/**
     2220 * @callback_method_impl{FNIOMIOPORTNEWOUT, Handling 0x3f1..0x3f5 accesses.}
    21882221 */
    21892222static DECLCALLBACK(VBOXSTRICTRC) fdcIoPort1Write(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT offPort, uint32_t u32, unsigned cb)
     
    22002233
    22012234/**
    2202  * @callback_method_impl{FNIOMIOPORTNEWIN, Handling 0x3f1..0x3f5 acceses.}
     2235 * @callback_method_impl{FNIOMIOPORTNEWIN, Handling 0x3f1..0x3f5 accesses.}
    22032236 */
    22042237static DECLCALLBACK(VBOXSTRICTRC) fdcIoPort1Read(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT offPort, uint32_t *pu32, unsigned cb)
     
    27252758     * Validate configuration.
    27262759     */
    2727     PDMDEV_VALIDATE_CONFIG_RETURN(pDevIns, "IRQ|DMA|MemMapped|IOBase", "");
     2760    PDMDEV_VALIDATE_CONFIG_RETURN(pDevIns, "IRQ|DMA|MemMapped|IOBase|StatusA", "");
    27282761
    27292762    /*
     
    27422775    rc = pHlp->pfnCFGMQueryBoolDef(pCfg, "MemMapped", &fMemMapped, false);
    27432776    AssertMsgRCReturn(rc, ("Configuration error: Failed to read bool value MemMapped rc=%Rrc\n", rc), rc);
     2777
     2778    bool fStatusA;
     2779    rc = pHlp->pfnCFGMQueryBoolDef(pCfg, "StatusA", &fStatusA, false);
     2780    AssertMsgRCReturn(rc, ("Configuration error: Failed to read bool value fStatusA rc=%Rrc\n", rc), rc);
    27442781
    27452782    /*
     
    27512788    pThis->config    = FD_CONFIG_EIS | FD_CONFIG_EFIFO; /* Implicit seek, polling & FIFO enabled */
    27522789    pThis->num_floppies = MAX_FD;
     2790    pThis->hIoPorts0 = NIL_IOMMMIOHANDLE;
     2791    pThis->hIoPorts1 = NIL_IOMMMIOHANDLE;
     2792    pThis->hIoPorts2 = NIL_IOMMMIOHANDLE;
    27532793
    27542794    /* Fill 'command_to_handler' lookup table */
     
    28122852            { NULL, NULL, NULL, NULL }
    28132853        };
     2854
     2855        /* 0x3f0 */
     2856        if (fStatusA)
     2857        {
     2858            rc = PDMDevHlpIoPortCreateAndMap(pDevIns, pThis->io_base, 1 /*cPorts*/, fdcIoPort0Write, fdcIoPort0Read,
     2859                                             "FDC-SRA", s_aDescs, &pThis->hIoPorts0);
     2860            AssertRCReturn(rc, rc);
     2861        }
    28142862
    28152863        /* 0x3f1..0x3f5 */
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