#endif
/* Register offsets. */
-#define VMCI_STATUS_ADDR 0x00
-#define VMCI_CONTROL_ADDR 0x04
-#define VMCI_ICR_ADDR 0x08
-#define VMCI_IMR_ADDR 0x0c
-#define VMCI_DATA_OUT_ADDR 0x10
-#define VMCI_DATA_IN_ADDR 0x14
-#define VMCI_CAPS_ADDR 0x18
-#define VMCI_RESULT_LOW_ADDR 0x1c
-#define VMCI_RESULT_HIGH_ADDR 0x20
+#define VMCI_STATUS_ADDR 0x00
+#define VMCI_CONTROL_ADDR 0x04
+#define VMCI_ICR_ADDR 0x08
+#define VMCI_IMR_ADDR 0x0c
+#define VMCI_DATA_OUT_ADDR 0x10
+#define VMCI_DATA_IN_ADDR 0x14
+#define VMCI_CAPS_ADDR 0x18
+#define VMCI_RESULT_LOW_ADDR 0x1c
+#define VMCI_RESULT_HIGH_ADDR 0x20
+#define VMCI_DATA_OUT_LOW_ADDR 0x24
+#define VMCI_DATA_OUT_HIGH_ADDR 0x28
+#define VMCI_DATA_IN_LOW_ADDR 0x2c
+#define VMCI_DATA_IN_HIGH_ADDR 0x30
/* Max number of devices. */
#define VMCI_MAX_DEVICES 1
typedef VMCIFilterList VMCIProtoFilters[VMCI_FP_MAX];
typedef VMCIProtoFilters VMCIFilters[VMCI_FD_MAX];
+
+/*
+ * Common header for describing a buffer used for VMCI datagram
+ * send/receive using DMA. The header is placed in a single
+ * page buffer, and the address is presented to the device through
+ * the VMCI_DATA_OUT_LOW_ADDR/VMCI_DATA_OUT_HIGH_ADDR registers
+ * for send, and VMCI_DATA_IN_LOW_ADDR/VMCI_DATA_IN_HIGH_ADDR for
+ * receives. If opcode is 0, the header is followed immediately by
+ * the data area of the specified size in contiguous physical
+ * addresses. If opcode is 1, the header is followed by a series
+ * of scatter gather array elements (formatted as VMCISgElem)
+ * each describing contiguous physical buffers. The scatter gather
+ * array elements must all fit within the same page as the header.
+ * On send, the busy flag will be set by the guest when the buffer
+ * is ready for sending, and cleared by the device when the send
+ * is complete. On receive, the busy flag is cleared by the guest
+ * when the buffer is ready to receive new datagrams, and set by
+ * the device when the incoming datagrams have been copied to the
+ * buffer and are ready for guest consumption.
+ */
+
+#define VMCI_DATA_IN_OUT_DATA_INLINE 0
+#define VMCI_DATA_IN_OUT_DATA_SG_ARRAY 1
+
+typedef struct {
+ uint32 busy;
+ uint32 opcode; // 0: data follows header, 1: sg array follows header
+ uint32 size; // size of data or number of sg elements
+ uint32 rsvd;
+ uint64 result; // Result of a send datagram operation
+} VMCIDataInOutHeader;
+
+/*
+ * Format of the the scatter gather element used by SG arrays following
+ * VMCIDataInOutHeader.
+ */
+
+typedef struct {
+ uint64 addr; // guest physical address
+ uint64 size; // length of data
+} VMCISgElem;
+
#if defined __cplusplus
} // extern "C"
#endif