Add support for saving and restoring the state (registers) of the serial device. This follows the same pattern in RTC (https://github.com/rust-vmm/vm-superio/pull/65) by adding SerialState and SerialStateSer structs, where the former is a plain container for the data and the later mirrors it and derives Serialize, Deserialize and Versionize.
Both structures gives the caller full access to their fields. Apart from handling input buffers larger than FIFO_SIZE and retriggering interrupts that haven't been consumed by the driver, the current proposal makes no sanity checks on the fields in the state struct. This means, for example, one could set the upper four bits in IER register which is invalid.
If such sanity checks are desired, we can adjust the PR with a follow-up commit.
Add support for saving and restoring the state (registers) of the serial device. This follows the same pattern in RTC (https://github.com/rust-vmm/vm-superio/pull/65) by adding
SerialState
andSerialStateSer
structs, where the former is a plain container for the data and the later mirrors it and derivesSerialize
,Deserialize
andVersionize
. Both structures gives the caller full access to their fields. Apart from handling input buffers larger thanFIFO_SIZE
and retriggering interrupts that haven't been consumed by the driver, the current proposal makes no sanity checks on the fields in the state struct. This means, for example, one could set the upper four bits inIER
register which is invalid. If such sanity checks are desired, we can adjust the PR with a follow-up commit.