]>
Commit | Line | Data |
---|---|---|
fc0bdd99 IY |
1 | #ifndef PM_SMBUS_H |
2 | #define PM_SMBUS_H | |
3 | ||
d4842052 | 4 | #include "exec/memory.h" |
93198b6c CM |
5 | #include "hw/i2c/smbus_master.h" |
6 | ||
38ad4fae CM |
7 | #define PM_SMBUS_MAX_MSG_SIZE 32 |
8 | ||
fc0bdd99 | 9 | typedef struct PMSMBus { |
a5c82852 | 10 | I2CBus *smbus; |
798512e5 | 11 | MemoryRegion io; |
fc0bdd99 IY |
12 | |
13 | uint8_t smb_stat; | |
14 | uint8_t smb_ctl; | |
15 | uint8_t smb_cmd; | |
16 | uint8_t smb_addr; | |
17 | uint8_t smb_data0; | |
18 | uint8_t smb_data1; | |
38ad4fae CM |
19 | uint8_t smb_data[PM_SMBUS_MAX_MSG_SIZE]; |
20 | uint8_t smb_blkdata; | |
21 | uint8_t smb_auxctl; | |
22 | uint32_t smb_index; | |
23 | ||
24 | /* Set by pm_smbus.c */ | |
25 | void (*reset)(struct PMSMBus *s); | |
26 | ||
27 | /* Set by the user. */ | |
28 | bool i2c_enable; | |
e724385a CM |
29 | void (*set_irq)(struct PMSMBus *s, bool enabled); |
30 | void *opaque; | |
38ad4fae CM |
31 | |
32 | /* Internally used by pm_smbus. */ | |
33 | ||
34 | /* Set on block transfers after the last byte has been read, so the | |
35 | INTR bit can be set at the right time. */ | |
36 | bool op_done; | |
52cc6a49 CM |
37 | |
38 | /* Set during an I2C block read, so we know how to handle data. */ | |
39 | bool in_i2c_block_read; | |
40 | ||
41 | /* Used to work around a bug in AMIBIOS, see smb_transaction_start() */ | |
42 | bool start_transaction_on_status_read; | |
fc0bdd99 IY |
43 | } PMSMBus; |
44 | ||
45726b6e | 45 | void pm_smbus_init(DeviceState *parent, PMSMBus *smb, bool force_aux_blk); |
fc0bdd99 | 46 | |
4ab2f2a8 CM |
47 | /* |
48 | * For backwards compatibility on migration, older versions don't have | |
49 | * working migration for pm_smbus, this lets us ignore the migrations | |
50 | * for older machine versions. | |
51 | */ | |
52 | bool pm_smbus_vmstate_needed(void); | |
53 | ||
54 | extern const VMStateDescription pmsmb_vmstate; | |
55 | ||
175de524 | 56 | #endif /* PM_SMBUS_H */ |