Changeset 50876 in vbox
- Timestamp:
- Mar 26, 2014 12:43:08 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Serial/DevSerial.cpp
r45025 r50876 68 68 *******************************************************************************/ 69 69 #define SERIAL_SAVED_STATE_VERSION_16450 3 70 #define SERIAL_SAVED_STATE_VERSION 4 70 #define SERIAL_SAVED_STATE_VERSION_MISSING_BITS 4 71 #define SERIAL_SAVED_STATE_VERSION 5 71 72 72 73 #define UART_LCR_DLAB 0x80 /* Divisor latch access bit */ … … 930 931 SSMR3PutBool(pSSM, pThis->msr_changed); 931 932 933 /* Version 5, safe everything that might be of importance. Much better than 934 missing relevant bits! */ 935 SSMR3PutU8(pSSM, pThis->thr); 936 SSMR3PutU8(pSSM, pThis->tsr); 937 SSMR3PutU8(pSSM, pThis->iir); 938 SSMR3PutS32(pSSM, pThis->timeout_ipending); 939 TMR3TimerSave(pThis->fifo_timeout_timer, pSSM); 940 TMR3TimerSave(pThis->transmit_timerR3, pSSM); 941 SSMR3PutU8(pSSM, pThis->recv_fifo.itl); 942 SSMR3PutU8(pSSM, pThis->xmit_fifo.itl); 943 932 944 /* Don't store: 933 945 * - the content of the FIFO … … 944 956 static DECLCALLBACK(int) serialLoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass) 945 957 { 946 PDEVSERIAL pThis = PDMINS_2_DATA(pDevIns, PDEVSERIAL); 947 948 if (uVersion == SERIAL_SAVED_STATE_VERSION_16450) 949 { 950 pThis->f16550AEnabled = false; 951 LogRel(("Serial#%d: falling back to 16450 mode from load state\n", pDevIns->iInstance)); 958 PDEVSERIAL pThis = PDMINS_2_DATA(pDevIns, PDEVSERIAL); 959 int32_t iIrq; 960 uint32_t IOBase; 961 962 AssertMsgReturn(uVersion >= SERIAL_SAVED_STATE_VERSION_16450, ("%d\n", uVersion), VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION); 963 964 if (uPass != SSM_PASS_FINAL) 965 { 966 SSMR3GetS32(pSSM, &iIrq); 967 int rc = SSMR3GetU32(pSSM, &IOBase); 968 AssertRCReturn(rc, rc); 952 969 } 953 970 else 954 AssertMsgReturn(uVersion == SERIAL_SAVED_STATE_VERSION, ("%d\n", uVersion), VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION); 955 956 if (uPass == SSM_PASS_FINAL) 957 { 971 { 972 if (uVersion == SERIAL_SAVED_STATE_VERSION_16450) 973 { 974 pThis->f16550AEnabled = false; 975 LogRel(("Serial#%d: falling back to 16450 mode from load state\n", pDevIns->iInstance)); 976 } 977 958 978 SSMR3GetU16(pSSM, &pThis->divider); 959 979 SSMR3GetU8(pSSM, &pThis->rbr); … … 965 985 SSMR3GetU8(pSSM, &pThis->scr); 966 986 if (uVersion > SERIAL_SAVED_STATE_VERSION_16450) 987 SSMR3GetU8(pSSM, &pThis->fcr); 988 SSMR3GetS32(pSSM, &pThis->thr_ipending); 989 SSMR3GetS32(pSSM, &iIrq); 990 SSMR3GetS32(pSSM, &pThis->last_break_enable); 991 SSMR3GetU32(pSSM, &IOBase); 992 SSMR3GetBool(pSSM, &pThis->msr_changed); 993 994 if (uVersion > SERIAL_SAVED_STATE_VERSION_MISSING_BITS) 967 995 { 968 SSMR3GetU8(pSSM, &pThis->fcr); 969 } 970 SSMR3GetS32(pSSM, &pThis->thr_ipending); 971 } 972 973 int32_t iIrq; 974 SSMR3GetS32(pSSM, &iIrq); 975 976 if (uPass == SSM_PASS_FINAL) 977 SSMR3GetS32(pSSM, &pThis->last_break_enable); 978 979 uint32_t IOBase; 980 int rc = SSMR3GetU32(pSSM, &IOBase); 981 AssertRCReturn(rc, rc); 982 983 if ( pThis->irq != iIrq 984 || pThis->base != IOBase) 985 return SSMR3SetCfgError(pSSM, RT_SRC_POS, 986 N_("Config mismatch - saved irq=%#x iobase=%#x; configured irq=%#x iobase=%#x"), 987 iIrq, IOBase, pThis->irq, pThis->base); 988 989 if (uPass == SSM_PASS_FINAL) 990 { 991 SSMR3GetBool(pSSM, &pThis->msr_changed); 992 996 SSMR3GetU8(pSSM, &pThis->thr); 997 SSMR3GetU8(pSSM, &pThis->tsr); 998 SSMR3GetU8(pSSM, &pThis->iir); 999 SSMR3GetS32(pSSM, &pThis->timeout_ipending); 1000 TMR3TimerLoad(pThis->fifo_timeout_timer, pSSM); 1001 TMR3TimerLoad(pThis->transmit_timerR3, pSSM); 1002 SSMR3GetU8(pSSM, &pThis->recv_fifo.itl); 1003 SSMR3GetU8(pSSM, &pThis->xmit_fifo.itl); 1004 } 1005 1006 /* the marker. */ 993 1007 uint32_t u32; 994 rc = SSMR3GetU32(pSSM, &u32);1008 int rc = SSMR3GetU32(pSSM, &u32); 995 1009 if (RT_FAILURE(rc)) 996 1010 return rc; … … 1010 1024 pThis->pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns); 1011 1025 } 1026 1027 /* 1028 * Check the config. 1029 */ 1030 if ( pThis->irq != iIrq 1031 || pThis->base != IOBase) 1032 return SSMR3SetCfgError(pSSM, RT_SRC_POS, 1033 N_("Config mismatch - saved irq=%#x iobase=%#x; configured irq=%#x iobase=%#x"), 1034 iIrq, IOBase, pThis->irq, pThis->base); 1012 1035 1013 1036 return VINF_SUCCESS;
Note:
See TracChangeset
for help on using the changeset viewer.