shpc.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #ifndef SHPC_H
  2. #define SHPC_H
  3. #include "qemu-common.h"
  4. #include "memory.h"
  5. #include "vmstate.h"
  6. struct SHPCDevice {
  7. /* Capability offset in device's config space */
  8. int cap;
  9. /* # of hot-pluggable slots */
  10. int nslots;
  11. /* SHPC WRS: working register set */
  12. uint8_t *config;
  13. /* Used to enable checks on load. Note that writable bits are
  14. * never checked even if set in cmask. */
  15. uint8_t *cmask;
  16. /* Used to implement R/W bytes */
  17. uint8_t *wmask;
  18. /* Used to implement RW1C(Write 1 to Clear) bytes */
  19. uint8_t *w1cmask;
  20. /* MMIO for the SHPC BAR */
  21. MemoryRegion mmio;
  22. /* Bus controlled by this SHPC */
  23. PCIBus *sec_bus;
  24. /* MSI already requested for this event */
  25. int msi_requested;
  26. };
  27. void shpc_reset(PCIDevice *d);
  28. int shpc_bar_size(PCIDevice *dev);
  29. int shpc_init(PCIDevice *dev, PCIBus *sec_bus, MemoryRegion *bar, unsigned off);
  30. void shpc_cleanup(PCIDevice *dev, MemoryRegion *bar);
  31. void shpc_cap_write_config(PCIDevice *d, uint32_t addr, uint32_t val, int len);
  32. extern VMStateInfo shpc_vmstate_info;
  33. #define SHPC_VMSTATE(_field, _type) \
  34. VMSTATE_BUFFER_UNSAFE_INFO(_field, _type, 0, shpc_vmstate_info, 0)
  35. #endif