xref: /qemu/include/hw/pci/shpc.h (revision 022c62cbbcf1ff40b23c92874f8670cddfec2414)
11dc324d2SMichael S. Tsirkin #ifndef SHPC_H
21dc324d2SMichael S. Tsirkin #define SHPC_H
31dc324d2SMichael S. Tsirkin 
41dc324d2SMichael S. Tsirkin #include "qemu-common.h"
5*022c62cbSPaolo Bonzini #include "exec/memory.h"
61dc324d2SMichael S. Tsirkin #include "vmstate.h"
71dc324d2SMichael S. Tsirkin 
81dc324d2SMichael S. Tsirkin struct SHPCDevice {
91dc324d2SMichael S. Tsirkin     /* Capability offset in device's config space */
101dc324d2SMichael S. Tsirkin     int cap;
111dc324d2SMichael S. Tsirkin 
121dc324d2SMichael S. Tsirkin     /* # of hot-pluggable slots */
131dc324d2SMichael S. Tsirkin     int nslots;
141dc324d2SMichael S. Tsirkin 
151dc324d2SMichael S. Tsirkin     /* SHPC WRS: working register set */
161dc324d2SMichael S. Tsirkin     uint8_t *config;
171dc324d2SMichael S. Tsirkin 
181dc324d2SMichael S. Tsirkin     /* Used to enable checks on load. Note that writable bits are
191dc324d2SMichael S. Tsirkin      * never checked even if set in cmask. */
201dc324d2SMichael S. Tsirkin     uint8_t *cmask;
211dc324d2SMichael S. Tsirkin 
221dc324d2SMichael S. Tsirkin     /* Used to implement R/W bytes */
231dc324d2SMichael S. Tsirkin     uint8_t *wmask;
241dc324d2SMichael S. Tsirkin 
251dc324d2SMichael S. Tsirkin     /* Used to implement RW1C(Write 1 to Clear) bytes */
261dc324d2SMichael S. Tsirkin     uint8_t *w1cmask;
271dc324d2SMichael S. Tsirkin 
281dc324d2SMichael S. Tsirkin     /* MMIO for the SHPC BAR */
291dc324d2SMichael S. Tsirkin     MemoryRegion mmio;
301dc324d2SMichael S. Tsirkin 
311dc324d2SMichael S. Tsirkin     /* Bus controlled by this SHPC */
321dc324d2SMichael S. Tsirkin     PCIBus *sec_bus;
331dc324d2SMichael S. Tsirkin 
341dc324d2SMichael S. Tsirkin     /* MSI already requested for this event */
351dc324d2SMichael S. Tsirkin     int msi_requested;
361dc324d2SMichael S. Tsirkin };
371dc324d2SMichael S. Tsirkin 
381dc324d2SMichael S. Tsirkin void shpc_reset(PCIDevice *d);
391dc324d2SMichael S. Tsirkin int shpc_bar_size(PCIDevice *dev);
401dc324d2SMichael S. Tsirkin int shpc_init(PCIDevice *dev, PCIBus *sec_bus, MemoryRegion *bar, unsigned off);
411dc324d2SMichael S. Tsirkin void shpc_cleanup(PCIDevice *dev, MemoryRegion *bar);
421dc324d2SMichael S. Tsirkin void shpc_cap_write_config(PCIDevice *d, uint32_t addr, uint32_t val, int len);
431dc324d2SMichael S. Tsirkin 
441dc324d2SMichael S. Tsirkin extern VMStateInfo shpc_vmstate_info;
451dc324d2SMichael S. Tsirkin #define SHPC_VMSTATE(_field, _type) \
461dc324d2SMichael S. Tsirkin     VMSTATE_BUFFER_UNSAFE_INFO(_field, _type, 0, shpc_vmstate_info, 0)
471dc324d2SMichael S. Tsirkin 
481dc324d2SMichael S. Tsirkin #endif
49