xref: /freebsd/sys/dev/hyperv/include/vmbus_xact.h (revision 95ee2897e98f5d444f26ed2334cc7c439f9c16c6)
16212aa15SSepherosa Ziehau /*-
26212aa15SSepherosa Ziehau  * Copyright (c) 2016 Microsoft Corp.
36212aa15SSepherosa Ziehau  * All rights reserved.
46212aa15SSepherosa Ziehau  *
56212aa15SSepherosa Ziehau  * Redistribution and use in source and binary forms, with or without
66212aa15SSepherosa Ziehau  * modification, are permitted provided that the following conditions
76212aa15SSepherosa Ziehau  * are met:
86212aa15SSepherosa Ziehau  * 1. Redistributions of source code must retain the above copyright
96212aa15SSepherosa Ziehau  *    notice unmodified, this list of conditions, and the following
106212aa15SSepherosa Ziehau  *    disclaimer.
116212aa15SSepherosa Ziehau  * 2. Redistributions in binary form must reproduce the above copyright
126212aa15SSepherosa Ziehau  *    notice, this list of conditions and the following disclaimer in the
136212aa15SSepherosa Ziehau  *    documentation and/or other materials provided with the distribution.
146212aa15SSepherosa Ziehau  *
156212aa15SSepherosa Ziehau  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
166212aa15SSepherosa Ziehau  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
176212aa15SSepherosa Ziehau  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
186212aa15SSepherosa Ziehau  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
196212aa15SSepherosa Ziehau  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
206212aa15SSepherosa Ziehau  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
216212aa15SSepherosa Ziehau  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
226212aa15SSepherosa Ziehau  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
236212aa15SSepherosa Ziehau  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
246212aa15SSepherosa Ziehau  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
256212aa15SSepherosa Ziehau  */
266212aa15SSepherosa Ziehau 
276212aa15SSepherosa Ziehau #ifndef _VMBUS_XACT_H_
286212aa15SSepherosa Ziehau #define _VMBUS_XACT_H_
296212aa15SSepherosa Ziehau 
306212aa15SSepherosa Ziehau #include <sys/param.h>
316212aa15SSepherosa Ziehau #include <sys/bus.h>
326212aa15SSepherosa Ziehau 
336212aa15SSepherosa Ziehau struct vmbus_xact;
346212aa15SSepherosa Ziehau struct vmbus_xact_ctx;
356212aa15SSepherosa Ziehau 
366212aa15SSepherosa Ziehau struct vmbus_xact_ctx	*vmbus_xact_ctx_create(bus_dma_tag_t dtag,
373dba61ddSSepherosa Ziehau 			    size_t req_size, size_t resp_size,
383dba61ddSSepherosa Ziehau 			    size_t priv_size);
396212aa15SSepherosa Ziehau void			vmbus_xact_ctx_destroy(struct vmbus_xact_ctx *ctx);
40494ec41aSSepherosa Ziehau bool			vmbus_xact_ctx_orphan(struct vmbus_xact_ctx *ctx);
41494ec41aSSepherosa Ziehau 
426212aa15SSepherosa Ziehau struct vmbus_xact	*vmbus_xact_get(struct vmbus_xact_ctx *ctx,
436212aa15SSepherosa Ziehau 			    size_t req_len);
446212aa15SSepherosa Ziehau void			vmbus_xact_put(struct vmbus_xact *xact);
456212aa15SSepherosa Ziehau 
466212aa15SSepherosa Ziehau void			*vmbus_xact_req_data(const struct vmbus_xact *xact);
476212aa15SSepherosa Ziehau bus_addr_t		vmbus_xact_req_paddr(const struct vmbus_xact *xact);
483dba61ddSSepherosa Ziehau void			*vmbus_xact_priv(const struct vmbus_xact *xact,
493dba61ddSSepherosa Ziehau 			    size_t priv_len);
506212aa15SSepherosa Ziehau void			vmbus_xact_activate(struct vmbus_xact *xact);
516212aa15SSepherosa Ziehau void			vmbus_xact_deactivate(struct vmbus_xact *xact);
526212aa15SSepherosa Ziehau const void		*vmbus_xact_wait(struct vmbus_xact *xact,
536212aa15SSepherosa Ziehau 			    size_t *resp_len);
548f3bf5f9SSepherosa Ziehau const void		*vmbus_xact_busywait(struct vmbus_xact *xact,
558f3bf5f9SSepherosa Ziehau 			    size_t *resp_len);
56*1b34e695SSepherosa Ziehau const void		*vmbus_xact_poll(struct vmbus_xact *xact,
57*1b34e695SSepherosa Ziehau 			    size_t *resp_len);
586212aa15SSepherosa Ziehau void			vmbus_xact_wakeup(struct vmbus_xact *xact,
596212aa15SSepherosa Ziehau 			    const void *data, size_t dlen);
603dba61ddSSepherosa Ziehau void			vmbus_xact_ctx_wakeup(struct vmbus_xact_ctx *ctx,
613dba61ddSSepherosa Ziehau 			    const void *data, size_t dlen);
626212aa15SSepherosa Ziehau 
636212aa15SSepherosa Ziehau #endif	/* !_VMBUS_XACT_H_ */
64