summaryrefslogtreecommitdiffstats
path: root/sys/dev/hyperv/include
diff options
context:
space:
mode:
authorsephe <sephe@FreeBSD.org>2016-10-13 02:28:40 +0000
committersephe <sephe@FreeBSD.org>2016-10-13 02:28:40 +0000
commitce51f905b80eb38c9ec35ba1af9cedd66a760765 (patch)
treeabf4e01f88be3c0713026f06e1a03fbdc51e3e41 /sys/dev/hyperv/include
parent1490fe42f7267bf24dd86228a8dd653240f407c7 (diff)
downloadFreeBSD-src-ce51f905b80eb38c9ec35ba1af9cedd66a760765.zip
FreeBSD-src-ce51f905b80eb38c9ec35ba1af9cedd66a760765.tar.gz
MFC 303945,303947-303949,303989,303992,303998,304001,304002,304109,304111
303945 hyperv/vmbus: Add macro to get channel packet data length. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7455 303947 hyperv/vmbus: Add APIs for various types of transactions. Reviewed by: Jun Su <junsu microsoft com> Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7456 303948 hyperv/hn: Switch to vmbus xact APIs for NVS initialization Reviewed by: Jun Su <junsu microsoft com> Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7457 303949 hyperv/vmbus: Use xact APIs to implement post message Hypercall APIs Avoid code duplication. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7458 303989 hyperv/hn: Simplify NDIS configuration. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7466 303992 hyperv/hn: Simplify NDIS initialization. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7467 303998 hyperv/hn: Switch to vmbus xact APIs for NVS RXBUF connection. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7469 304001 hyperv/hn: Switch to vmbus xact APIs for NVS chimney buffer connection. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7470 304002 hyperv/hn: Simplify RXBUF disconnection. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7472 304109 hyperv/hn: Simplify chimney sending buffer disconnection. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7479 304111 hyperv/hn: Switch to vmbus xact APIs for sub-channel alloc request. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7480
Diffstat (limited to 'sys/dev/hyperv/include')
-rw-r--r--sys/dev/hyperv/include/vmbus.h5
-rw-r--r--sys/dev/hyperv/include/vmbus_xact.h60
2 files changed, 65 insertions, 0 deletions
diff --git a/sys/dev/hyperv/include/vmbus.h b/sys/dev/hyperv/include/vmbus.h
index bf72a9b..fa5065a 100644
--- a/sys/dev/hyperv/include/vmbus.h
+++ b/sys/dev/hyperv/include/vmbus.h
@@ -90,6 +90,11 @@ struct vmbus_chanpkt_hdr {
(const void *)((const uint8_t *)(pkt) + \
VMBUS_CHANPKT_GETLEN((pkt)->cph_hlen))
+/* Include padding */
+#define VMBUS_CHANPKT_DATALEN(pkt) \
+ (VMBUS_CHANPKT_GETLEN((pkt)->cph_tlen) -\
+ VMBUS_CHANPKT_GETLEN((pkt)->cph_hlen))
+
struct vmbus_rxbuf_desc {
uint32_t rb_len;
uint32_t rb_ofs;
diff --git a/sys/dev/hyperv/include/vmbus_xact.h b/sys/dev/hyperv/include/vmbus_xact.h
new file mode 100644
index 0000000..62fda01
--- /dev/null
+++ b/sys/dev/hyperv/include/vmbus_xact.h
@@ -0,0 +1,60 @@
+/*-
+ * Copyright (c) 2016 Microsoft Corp.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice unmodified, this list of conditions, and the following
+ * disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _VMBUS_XACT_H_
+#define _VMBUS_XACT_H_
+
+#include <sys/param.h>
+#include <sys/bus.h>
+#include <machine/bus.h>
+
+struct vmbus_xact;
+struct vmbus_xact_ctx;
+
+struct vmbus_xact_ctx *vmbus_xact_ctx_create(bus_dma_tag_t dtag,
+ size_t req_size, size_t resp_size,
+ size_t priv_size);
+void vmbus_xact_ctx_destroy(struct vmbus_xact_ctx *ctx);
+struct vmbus_xact *vmbus_xact_get(struct vmbus_xact_ctx *ctx,
+ size_t req_len);
+void vmbus_xact_put(struct vmbus_xact *xact);
+
+void *vmbus_xact_req_data(const struct vmbus_xact *xact);
+bus_addr_t vmbus_xact_req_paddr(const struct vmbus_xact *xact);
+void *vmbus_xact_priv(const struct vmbus_xact *xact,
+ size_t priv_len);
+void vmbus_xact_activate(struct vmbus_xact *xact);
+void vmbus_xact_deactivate(struct vmbus_xact *xact);
+const void *vmbus_xact_wait(struct vmbus_xact *xact,
+ size_t *resp_len);
+void vmbus_xact_wakeup(struct vmbus_xact *xact,
+ const void *data, size_t dlen);
+void vmbus_xact_ctx_wakeup(struct vmbus_xact_ctx *ctx,
+ const void *data, size_t dlen);
+
+#endif /* !_VMBUS_XACT_H_ */
OpenPOWER on IntegriCloud