1303947Ssephe/*-
2303947Ssephe * Copyright (c) 2016 Microsoft Corp.
3303947Ssephe * All rights reserved.
4303947Ssephe *
5303947Ssephe * Redistribution and use in source and binary forms, with or without
6303947Ssephe * modification, are permitted provided that the following conditions
7303947Ssephe * are met:
8303947Ssephe * 1. Redistributions of source code must retain the above copyright
9303947Ssephe *    notice unmodified, this list of conditions, and the following
10303947Ssephe *    disclaimer.
11303947Ssephe * 2. Redistributions in binary form must reproduce the above copyright
12303947Ssephe *    notice, this list of conditions and the following disclaimer in the
13303947Ssephe *    documentation and/or other materials provided with the distribution.
14303947Ssephe *
15303947Ssephe * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16303947Ssephe * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17303947Ssephe * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18303947Ssephe * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19303947Ssephe * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20303947Ssephe * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21303947Ssephe * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22303947Ssephe * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23303947Ssephe * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24303947Ssephe * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25303947Ssephe *
26303947Ssephe * $FreeBSD: stable/11/sys/dev/hyperv/include/vmbus_xact.h 311367 2017-01-05 05:46:06Z sephe $
27303947Ssephe */
28303947Ssephe
29303947Ssephe#ifndef _VMBUS_XACT_H_
30303947Ssephe#define _VMBUS_XACT_H_
31303947Ssephe
32303947Ssephe#include <sys/param.h>
33303947Ssephe#include <sys/bus.h>
34303947Ssephe
35303947Ssephestruct vmbus_xact;
36303947Ssephestruct vmbus_xact_ctx;
37303947Ssephe
38303947Ssephestruct vmbus_xact_ctx	*vmbus_xact_ctx_create(bus_dma_tag_t dtag,
39307475Ssephe			    size_t req_size, size_t resp_size,
40307475Ssephe			    size_t priv_size);
41303947Ssephevoid			vmbus_xact_ctx_destroy(struct vmbus_xact_ctx *ctx);
42311359Ssephebool			vmbus_xact_ctx_orphan(struct vmbus_xact_ctx *ctx);
43311359Ssephe
44303947Ssephestruct vmbus_xact	*vmbus_xact_get(struct vmbus_xact_ctx *ctx,
45303947Ssephe			    size_t req_len);
46303947Ssephevoid			vmbus_xact_put(struct vmbus_xact *xact);
47303947Ssephe
48303947Ssephevoid			*vmbus_xact_req_data(const struct vmbus_xact *xact);
49303947Ssephebus_addr_t		vmbus_xact_req_paddr(const struct vmbus_xact *xact);
50307475Ssephevoid			*vmbus_xact_priv(const struct vmbus_xact *xact,
51307475Ssephe			    size_t priv_len);
52303947Ssephevoid			vmbus_xact_activate(struct vmbus_xact *xact);
53303947Ssephevoid			vmbus_xact_deactivate(struct vmbus_xact *xact);
54303947Ssepheconst void		*vmbus_xact_wait(struct vmbus_xact *xact,
55303947Ssephe			    size_t *resp_len);
56311356Ssepheconst void		*vmbus_xact_busywait(struct vmbus_xact *xact,
57311356Ssephe			    size_t *resp_len);
58311367Ssepheconst void		*vmbus_xact_poll(struct vmbus_xact *xact,
59311367Ssephe			    size_t *resp_len);
60303947Ssephevoid			vmbus_xact_wakeup(struct vmbus_xact *xact,
61303947Ssephe			    const void *data, size_t dlen);
62307475Ssephevoid			vmbus_xact_ctx_wakeup(struct vmbus_xact_ctx *ctx,
63307475Ssephe			    const void *data, size_t dlen);
64303947Ssephe
65303947Ssephe#endif	/* !_VMBUS_XACT_H_ */
66