xref: /openbmc/qemu/include/hw/i2c/pm_smbus.h (revision 073d9f2c)
1 #ifndef PM_SMBUS_H
2 #define PM_SMBUS_H
3 
4 #define PM_SMBUS_MAX_MSG_SIZE 32
5 
6 typedef struct PMSMBus {
7     I2CBus *smbus;
8     MemoryRegion io;
9 
10     uint8_t smb_stat;
11     uint8_t smb_ctl;
12     uint8_t smb_cmd;
13     uint8_t smb_addr;
14     uint8_t smb_data0;
15     uint8_t smb_data1;
16     uint8_t smb_data[PM_SMBUS_MAX_MSG_SIZE];
17     uint8_t smb_blkdata;
18     uint8_t smb_auxctl;
19     uint32_t smb_index;
20 
21     /* Set by pm_smbus.c */
22     void (*reset)(struct PMSMBus *s);
23 
24     /* Set by the user. */
25     bool i2c_enable;
26     void (*set_irq)(struct PMSMBus *s, bool enabled);
27     void *opaque;
28 
29     /* Internally used by pm_smbus. */
30 
31     /* Set on block transfers after the last byte has been read, so the
32        INTR bit can be set at the right time. */
33     bool op_done;
34 } PMSMBus;
35 
36 void pm_smbus_init(DeviceState *parent, PMSMBus *smb, bool force_aux_blk);
37 
38 #endif /* PM_SMBUS_H */
39