mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-06 09:13:55 -06:00
i2c:pm_smbus: Fix state transfer
Transfer the state information for the SMBus registers and internal data so it will work on a VM transfer. Signed-off-by: Corey Minyard <cminyard@mvista.com> Cc: Michael S. Tsirkin <mst@redhat.com> Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
This commit is contained in:
parent
8e995f3403
commit
4ab2f2a8aa
4 changed files with 56 additions and 1 deletions
|
@ -19,6 +19,7 @@
|
|||
*/
|
||||
#include "qemu/osdep.h"
|
||||
#include "hw/hw.h"
|
||||
#include "hw/boards.h"
|
||||
#include "hw/i2c/pm_smbus.h"
|
||||
#include "hw/i2c/smbus_master.h"
|
||||
|
||||
|
@ -453,6 +454,36 @@ static const MemoryRegionOps pm_smbus_ops = {
|
|||
.endianness = DEVICE_LITTLE_ENDIAN,
|
||||
};
|
||||
|
||||
bool pm_smbus_vmstate_needed(void)
|
||||
{
|
||||
MachineClass *mc = MACHINE_GET_CLASS(qdev_get_machine());
|
||||
|
||||
return !mc->smbus_no_migration_support;
|
||||
}
|
||||
|
||||
const VMStateDescription pmsmb_vmstate = {
|
||||
.name = "pmsmb",
|
||||
.version_id = 1,
|
||||
.minimum_version_id = 1,
|
||||
.fields = (VMStateField[]) {
|
||||
VMSTATE_UINT8(smb_stat, PMSMBus),
|
||||
VMSTATE_UINT8(smb_ctl, PMSMBus),
|
||||
VMSTATE_UINT8(smb_cmd, PMSMBus),
|
||||
VMSTATE_UINT8(smb_addr, PMSMBus),
|
||||
VMSTATE_UINT8(smb_data0, PMSMBus),
|
||||
VMSTATE_UINT8(smb_data1, PMSMBus),
|
||||
VMSTATE_UINT32(smb_index, PMSMBus),
|
||||
VMSTATE_UINT8_ARRAY(smb_data, PMSMBus, PM_SMBUS_MAX_MSG_SIZE),
|
||||
VMSTATE_UINT8(smb_auxctl, PMSMBus),
|
||||
VMSTATE_UINT8(smb_blkdata, PMSMBus),
|
||||
VMSTATE_BOOL(i2c_enable, PMSMBus),
|
||||
VMSTATE_BOOL(op_done, PMSMBus),
|
||||
VMSTATE_BOOL(in_i2c_block_read, PMSMBus),
|
||||
VMSTATE_BOOL(start_transaction_on_status_read, PMSMBus),
|
||||
VMSTATE_END_OF_LIST()
|
||||
}
|
||||
};
|
||||
|
||||
void pm_smbus_init(DeviceState *parent, PMSMBus *smb, bool force_aux_blk)
|
||||
{
|
||||
smb->op_done = true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue