Merge remote-tracking branch 'remotes/palmer/tags/riscv-for-master-4.1-sf1-v3' into...
[qemu/ar7.git] / include / hw / i2c / pm_smbus.h
blobfb55c444447771328b7e79dc3e3f00842a5f27af
1 #ifndef PM_SMBUS_H
2 #define PM_SMBUS_H
4 #include "hw/i2c/smbus_master.h"
6 #define PM_SMBUS_MAX_MSG_SIZE 32
8 typedef struct PMSMBus {
9 I2CBus *smbus;
10 MemoryRegion io;
12 uint8_t smb_stat;
13 uint8_t smb_ctl;
14 uint8_t smb_cmd;
15 uint8_t smb_addr;
16 uint8_t smb_data0;
17 uint8_t smb_data1;
18 uint8_t smb_data[PM_SMBUS_MAX_MSG_SIZE];
19 uint8_t smb_blkdata;
20 uint8_t smb_auxctl;
21 uint32_t smb_index;
23 /* Set by pm_smbus.c */
24 void (*reset)(struct PMSMBus *s);
26 /* Set by the user. */
27 bool i2c_enable;
28 void (*set_irq)(struct PMSMBus *s, bool enabled);
29 void *opaque;
31 /* Internally used by pm_smbus. */
33 /* Set on block transfers after the last byte has been read, so the
34 INTR bit can be set at the right time. */
35 bool op_done;
37 /* Set during an I2C block read, so we know how to handle data. */
38 bool in_i2c_block_read;
40 /* Used to work around a bug in AMIBIOS, see smb_transaction_start() */
41 bool start_transaction_on_status_read;
42 } PMSMBus;
44 void pm_smbus_init(DeviceState *parent, PMSMBus *smb, bool force_aux_blk);
47 * For backwards compatibility on migration, older versions don't have
48 * working migration for pm_smbus, this lets us ignore the migrations
49 * for older machine versions.
51 bool pm_smbus_vmstate_needed(void);
53 extern const VMStateDescription pmsmb_vmstate;
55 #endif /* PM_SMBUS_H */