summaryrefslogtreecommitdiffstats
path: root/sys/dev/hyperv/include/vmbus.h
diff options
context:
space:
mode:
authorsephe <sephe@FreeBSD.org>2016-10-17 03:24:03 +0000
committersephe <sephe@FreeBSD.org>2016-10-17 03:24:03 +0000
commit1ef061307bf715de97c38295189fc3b31a669061 (patch)
tree21338be8e682bdd7531c91d52cf7a3ea38b796c8 /sys/dev/hyperv/include/vmbus.h
parent2fac5b2b057c2bb6422b617a0d3ffdaa69a80bb0 (diff)
downloadFreeBSD-src-1ef061307bf715de97c38295189fc3b31a669061.zip
FreeBSD-src-1ef061307bf715de97c38295189fc3b31a669061.tar.gz
MFC 303066-303072,303127-303129,303131
303066 hyperv/vmbus: Get rid of unnecessary definition. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7240 303067 hyperv/vmbus: Move IC register definition to Hyper-V utilities Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7241 303068 hyperv/vmbus: Channel struct field rename Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7242 303069 hyperv/vmbus: Pass channel as the first argument for channel callback The prepares to kill device private fields in channel struct, which are not flexible and extensible. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7243 303070 hyperv/vmbus: Deprecate the device private data in channel struct They are neither flexible nor extensible. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7244 303071 hyperv/vmbus: Hide channel struct definition. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7245 303072 hyperv/vmbus: Save MNF trigger location instead of MNF trigger index. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7246 303127 hyperv/vmbus: Save event flag location and evet flag mask. This avoids unnecessary access to the vmbus_softc struct on sending path. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7257 303128 hyperv/vmbus: Reorder channel fields. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7258 303129 hyperv/vmbus: Shuffle function declaration and macro definition. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7259 303131 hyperv: hv_vmbus_channel -> vmbus_channel Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7260
Diffstat (limited to 'sys/dev/hyperv/include/vmbus.h')
-rw-r--r--sys/dev/hyperv/include/vmbus.h70
1 files changed, 51 insertions, 19 deletions
diff --git a/sys/dev/hyperv/include/vmbus.h b/sys/dev/hyperv/include/vmbus.h
index f453a34..7c06580 100644
--- a/sys/dev/hyperv/include/vmbus.h
+++ b/sys/dev/hyperv/include/vmbus.h
@@ -32,6 +32,23 @@
#include <sys/param.h>
/*
+ * VMBUS version is 32 bit, upper 16 bit for major_number and lower
+ * 16 bit for minor_number.
+ *
+ * 0.13 -- Windows Server 2008
+ * 1.1 -- Windows 7
+ * 2.4 -- Windows 8
+ * 3.0 -- Windows 8.1
+ */
+#define VMBUS_VERSION_WS2008 ((0 << 16) | (13))
+#define VMBUS_VERSION_WIN7 ((1 << 16) | (1))
+#define VMBUS_VERSION_WIN8 ((2 << 16) | (4))
+#define VMBUS_VERSION_WIN8_1 ((3 << 16) | (0))
+
+#define VMBUS_VERSION_MAJOR(ver) (((uint32_t)(ver)) >> 16)
+#define VMBUS_VERSION_MINOR(ver) (((uint32_t)(ver)) & 0xffff)
+
+/*
* GPA stuffs.
*/
struct vmbus_gpa_range {
@@ -87,41 +104,56 @@ struct vmbus_chanpkt_rxbuf {
#define VMBUS_CHAN_SGLIST_MAX 32
#define VMBUS_CHAN_PRPLIST_MAX 32
-struct hv_vmbus_channel;
+struct vmbus_channel;
+struct hyperv_guid;
+
+typedef void (*vmbus_chan_callback_t)(struct vmbus_channel *, void *);
-int vmbus_chan_open(struct hv_vmbus_channel *chan,
+static __inline struct vmbus_channel *
+vmbus_get_channel(device_t dev)
+{
+ return device_get_ivars(dev);
+}
+
+int vmbus_chan_open(struct vmbus_channel *chan,
int txbr_size, int rxbr_size, const void *udata, int udlen,
vmbus_chan_callback_t cb, void *cbarg);
-void vmbus_chan_close(struct hv_vmbus_channel *chan);
+void vmbus_chan_close(struct vmbus_channel *chan);
-int vmbus_chan_gpadl_connect(struct hv_vmbus_channel *chan,
+int vmbus_chan_gpadl_connect(struct vmbus_channel *chan,
bus_addr_t paddr, int size, uint32_t *gpadl);
-int vmbus_chan_gpadl_disconnect(struct hv_vmbus_channel *chan,
+int vmbus_chan_gpadl_disconnect(struct vmbus_channel *chan,
uint32_t gpadl);
-void vmbus_chan_cpu_set(struct hv_vmbus_channel *chan, int cpu);
-void vmbus_chan_cpu_rr(struct hv_vmbus_channel *chan);
-struct hv_vmbus_channel *
- vmbus_chan_cpu2chan(struct hv_vmbus_channel *chan, int cpu);
-void vmbus_chan_set_readbatch(struct hv_vmbus_channel *chan, bool on);
+void vmbus_chan_cpu_set(struct vmbus_channel *chan, int cpu);
+void vmbus_chan_cpu_rr(struct vmbus_channel *chan);
+struct vmbus_channel *
+ vmbus_chan_cpu2chan(struct vmbus_channel *chan, int cpu);
+void vmbus_chan_set_readbatch(struct vmbus_channel *chan, bool on);
-struct hv_vmbus_channel **
- vmbus_subchan_get(struct hv_vmbus_channel *pri_chan, int subchan_cnt);
-void vmbus_subchan_rel(struct hv_vmbus_channel **subchan, int subchan_cnt);
-void vmbus_subchan_drain(struct hv_vmbus_channel *pri_chan);
+struct vmbus_channel **
+ vmbus_subchan_get(struct vmbus_channel *pri_chan, int subchan_cnt);
+void vmbus_subchan_rel(struct vmbus_channel **subchan, int subchan_cnt);
+void vmbus_subchan_drain(struct vmbus_channel *pri_chan);
-int vmbus_chan_recv(struct hv_vmbus_channel *chan, void *data, int *dlen,
+int vmbus_chan_recv(struct vmbus_channel *chan, void *data, int *dlen,
uint64_t *xactid);
-int vmbus_chan_recv_pkt(struct hv_vmbus_channel *chan,
+int vmbus_chan_recv_pkt(struct vmbus_channel *chan,
struct vmbus_chanpkt_hdr *pkt, int *pktlen);
-int vmbus_chan_send(struct hv_vmbus_channel *chan, uint16_t type,
+int vmbus_chan_send(struct vmbus_channel *chan, uint16_t type,
uint16_t flags, void *data, int dlen, uint64_t xactid);
-int vmbus_chan_send_sglist(struct hv_vmbus_channel *chan,
+int vmbus_chan_send_sglist(struct vmbus_channel *chan,
struct vmbus_gpa sg[], int sglen, void *data, int dlen,
uint64_t xactid);
-int vmbus_chan_send_prplist(struct hv_vmbus_channel *chan,
+int vmbus_chan_send_prplist(struct vmbus_channel *chan,
struct vmbus_gpa_range *prp, int prp_cnt, void *data, int dlen,
uint64_t xactid);
+uint32_t vmbus_chan_id(const struct vmbus_channel *chan);
+uint32_t vmbus_chan_subidx(const struct vmbus_channel *chan);
+bool vmbus_chan_is_primary(const struct vmbus_channel *chan);
+const struct hyperv_guid *
+ vmbus_chan_guid_inst(const struct vmbus_channel *chan);
+
#endif /* !_VMBUS_H_ */
OpenPOWER on IntegriCloud