xref: /freebsd/sys/dev/hyperv/utilities/vmbus_icvar.h (revision 95ee2897e98f5d444f26ed2334cc7c439f9c16c6)
1*ed8107d1SSepherosa Ziehau /*-
2*ed8107d1SSepherosa Ziehau  * Copyright (c) 2009-2012,2016 Microsoft Corp.
3*ed8107d1SSepherosa Ziehau  * Copyright (c) 2012 NetApp Inc.
4*ed8107d1SSepherosa Ziehau  * Copyright (c) 2012 Citrix Inc.
5*ed8107d1SSepherosa Ziehau  * All rights reserved.
6*ed8107d1SSepherosa Ziehau  *
7*ed8107d1SSepherosa Ziehau  * Redistribution and use in source and binary forms, with or without
8*ed8107d1SSepherosa Ziehau  * modification, are permitted provided that the following conditions
9*ed8107d1SSepherosa Ziehau  * are met:
10*ed8107d1SSepherosa Ziehau  * 1. Redistributions of source code must retain the above copyright
11*ed8107d1SSepherosa Ziehau  *    notice unmodified, this list of conditions, and the following
12*ed8107d1SSepherosa Ziehau  *    disclaimer.
13*ed8107d1SSepherosa Ziehau  * 2. Redistributions in binary form must reproduce the above copyright
14*ed8107d1SSepherosa Ziehau  *    notice, this list of conditions and the following disclaimer in the
15*ed8107d1SSepherosa Ziehau  *    documentation and/or other materials provided with the distribution.
16*ed8107d1SSepherosa Ziehau  *
17*ed8107d1SSepherosa Ziehau  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18*ed8107d1SSepherosa Ziehau  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19*ed8107d1SSepherosa Ziehau  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20*ed8107d1SSepherosa Ziehau  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21*ed8107d1SSepherosa Ziehau  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22*ed8107d1SSepherosa Ziehau  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23*ed8107d1SSepherosa Ziehau  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24*ed8107d1SSepherosa Ziehau  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25*ed8107d1SSepherosa Ziehau  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26*ed8107d1SSepherosa Ziehau  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27*ed8107d1SSepherosa Ziehau  */
28*ed8107d1SSepherosa Ziehau 
29*ed8107d1SSepherosa Ziehau #ifndef _VMBUS_ICVAR_H_
30*ed8107d1SSepherosa Ziehau #define _VMBUS_ICVAR_H_
31*ed8107d1SSepherosa Ziehau 
32*ed8107d1SSepherosa Ziehau #include <dev/hyperv/include/hyperv.h>
33*ed8107d1SSepherosa Ziehau #include <dev/hyperv/include/vmbus.h>
34*ed8107d1SSepherosa Ziehau 
35*ed8107d1SSepherosa Ziehau struct vmbus_ic_softc {
36*ed8107d1SSepherosa Ziehau 	device_t		ic_dev;
37*ed8107d1SSepherosa Ziehau 	uint8_t			*ic_buf;
38*ed8107d1SSepherosa Ziehau 	int			ic_buflen;
39*ed8107d1SSepherosa Ziehau 	uint32_t		ic_fwver;	/* framework version */
40*ed8107d1SSepherosa Ziehau 	uint32_t		ic_msgver;	/* message version */
41*ed8107d1SSepherosa Ziehau };
42*ed8107d1SSepherosa Ziehau 
43*ed8107d1SSepherosa Ziehau struct vmbus_ic_desc {
44*ed8107d1SSepherosa Ziehau 	const struct hyperv_guid	ic_guid;
45*ed8107d1SSepherosa Ziehau 	const char			*ic_desc;
46*ed8107d1SSepherosa Ziehau };
47*ed8107d1SSepherosa Ziehau 
48*ed8107d1SSepherosa Ziehau #define VMBUS_IC_DESC_END	{ .ic_desc = NULL }
49*ed8107d1SSepherosa Ziehau 
50*ed8107d1SSepherosa Ziehau int		vmbus_ic_attach(device_t dev, vmbus_chan_callback_t cb);
51*ed8107d1SSepherosa Ziehau int		vmbus_ic_detach(device_t dev);
52*ed8107d1SSepherosa Ziehau int		vmbus_ic_probe(device_t dev, const struct vmbus_ic_desc descs[]);
53*ed8107d1SSepherosa Ziehau int		vmbus_ic_negomsg(struct vmbus_ic_softc *sc, void *data,
54*ed8107d1SSepherosa Ziehau 		    int *dlen, uint32_t fw_ver, uint32_t msg_ver);
55*ed8107d1SSepherosa Ziehau int		vmbus_ic_sendresp(struct vmbus_ic_softc *sc,
56*ed8107d1SSepherosa Ziehau 		    struct vmbus_channel *chan, void *data, int dlen,
57*ed8107d1SSepherosa Ziehau 		    uint64_t xactid);
58*ed8107d1SSepherosa Ziehau 
59*ed8107d1SSepherosa Ziehau #endif	/* !_VMBUS_ICVAR_H_ */
60