VirtualBox

Changeset 29889 in vbox for trunk/src


Ignore:
Timestamp:
May 31, 2010 10:06:26 AM (15 years ago)
Author:
vboxsync
Message:

Devices/Serial: SSM state adaption for 16550A emulation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Serial/DevSerial.cpp

    r29846 r29889  
    6767*   Defined Constants And Macros                                               *
    6868*******************************************************************************/
    69 #define SERIAL_SAVED_STATE_VERSION  3
     69#define SERIAL_SAVED_STATE_VERSION_16450        3
     70#define SERIAL_SAVED_STATE_VERSION              4
    7071
    7172#define UART_LCR_DLAB       0x80        /* Divisor latch access bit */
     
    216217    bool                            fYieldOnLSRRead;
    217218    bool volatile                   fRecvWaiting;
     219    bool                            f16550AEnabled;
    218220    bool                            Alignment3[3];
    219221    /** Time it takes to transmit a character */
     
    459461        break;
    460462    case 2:
     463        if (!s->f16550AEnabled)
     464            break;
     465
    461466        val = val & 0xFF;
    462467
     
    941946    SSMR3PutU8(pSSM, pThis->msr);
    942947    SSMR3PutU8(pSSM, pThis->scr);
     948    SSMR3PutU8(pSSM, pThis->fcr); /* 16550A */
    943949    SSMR3PutS32(pSSM, pThis->thr_ipending);
    944950    SSMR3PutS32(pSSM, pThis->irq);
     
    946952    SSMR3PutU32(pSSM, pThis->base);
    947953    SSMR3PutBool(pSSM, pThis->msr_changed);
     954
     955    /* Don't store:
     956     *  - the content of the FIFO
     957     *  - tsr_retry
     958     */
     959
    948960    return SSMR3PutU32(pSSM, ~0); /* sanity/terminator */
    949961}
     
    959971    SerialState *pThis = PDMINS_2_DATA(pDevIns, SerialState *);
    960972
    961     AssertMsgReturn(uVersion == SERIAL_SAVED_STATE_VERSION, ("%d\n", uVersion), VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION);
     973    if (uVersion == SERIAL_SAVED_STATE_VERSION_16450)
     974    {
     975        pThis->f16550AEnabled = false;
     976    }
     977    else
     978        AssertMsgReturn(uVersion == SERIAL_SAVED_STATE_VERSION, ("%d\n", uVersion), VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION);
    962979
    963980    if (uPass == SSM_PASS_FINAL)
     
    971988        SSMR3GetU8(pSSM, &pThis->msr);
    972989        SSMR3GetU8(pSSM, &pThis->scr);
     990        if (uVersion > SERIAL_SAVED_STATE_VERSION_16450)
     991        {
     992            SSMR3GetU8(pSSM, &pThis->fcr);
     993        }
    973994        SSMR3GetS32(pSSM, &pThis->thr_ipending);
    974995    }
     
    10001021        AssertMsgReturn(u32 == ~0U, ("%#x\n", u32), VERR_SSM_DATA_UNIT_FORMAT_CHANGED);
    10011022
    1002         if (pThis->lsr & UART_LSR_DR)
     1023        if (   (pThis->lsr & UART_LSR_DR)
     1024            || pThis->fRecvWaiting)
    10031025        {
     1026            pThis->fRecvWaiting = false;
    10041027            rc = RTSemEventSignal(pThis->ReceiveSem);
    10051028            AssertRC(rc);
     
    11921215#endif
    11931216
     1217    pThis->f16550AEnabled = true;
     1218
    11941219    /*
    11951220     * Initialize critical section and the semaphore.
     
    12461271            return rc;
    12471272    }
    1248 
    12491273
    12501274    if (pThis->fR0Enabled)
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