ioreq.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /* SPDX-License-Identifier: MIT */
  2. /*
  3. * ioreq.h: I/O request definitions for device models
  4. * Copyright (c) 2004, Intel Corporation.
  5. */
  6. #ifndef __XEN_PUBLIC_HVM_IOREQ_H__
  7. #define __XEN_PUBLIC_HVM_IOREQ_H__
  8. #define IOREQ_READ 1
  9. #define IOREQ_WRITE 0
  10. #define STATE_IOREQ_NONE 0
  11. #define STATE_IOREQ_READY 1
  12. #define STATE_IOREQ_INPROCESS 2
  13. #define STATE_IORESP_READY 3
  14. #define IOREQ_TYPE_PIO 0 /* pio */
  15. #define IOREQ_TYPE_COPY 1 /* mmio ops */
  16. #define IOREQ_TYPE_PCI_CONFIG 2
  17. #define IOREQ_TYPE_TIMEOFFSET 7
  18. #define IOREQ_TYPE_INVALIDATE 8 /* mapcache */
  19. /*
  20. * VMExit dispatcher should cooperate with instruction decoder to
  21. * prepare this structure and notify service OS and DM by sending
  22. * virq.
  23. *
  24. * For I/O type IOREQ_TYPE_PCI_CONFIG, the physical address is formatted
  25. * as follows:
  26. *
  27. * 63....48|47..40|39..35|34..32|31........0
  28. * SEGMENT |BUS |DEV |FN |OFFSET
  29. */
  30. struct ioreq {
  31. uint64_t addr; /* physical address */
  32. uint64_t data; /* data (or paddr of data) */
  33. uint32_t count; /* for rep prefixes */
  34. uint32_t size; /* size in bytes */
  35. uint32_t vp_eport; /* evtchn for notifications to/from device model */
  36. uint16_t _pad0;
  37. uint8_t state:4;
  38. uint8_t data_is_ptr:1; /* if 1, data above is the guest paddr
  39. * of the real data to use. */
  40. uint8_t dir:1; /* 1=read, 0=write */
  41. uint8_t df:1;
  42. uint8_t _pad1:1;
  43. uint8_t type; /* I/O type */
  44. };
  45. #endif /* __XEN_PUBLIC_HVM_IOREQ_H__ */