Deleted Added
full compact
hyperv.h (307458) hyperv.h (307459)
1/*-
2 * Copyright (c) 2009-2012,2016 Microsoft Corp.
3 * Copyright (c) 2012 NetApp Inc.
4 * Copyright (c) 2012 Citrix Inc.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 11 unchanged lines hidden (view full) ---

20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
1/*-
2 * Copyright (c) 2009-2012,2016 Microsoft Corp.
3 * Copyright (c) 2012 NetApp Inc.
4 * Copyright (c) 2012 Citrix Inc.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 11 unchanged lines hidden (view full) ---

20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * $FreeBSD: stable/11/sys/dev/hyperv/include/hyperv.h 307458 2016-10-17 02:38:44Z sephe $
28 * $FreeBSD: stable/11/sys/dev/hyperv/include/hyperv.h 307459 2016-10-17 02:44:27Z sephe $
29 */
30
31/**
32 * HyperV definitions for messages that are sent between instances of the
33 * Channel Management Library in separate partitions, or in some cases,
34 * back to itself.
35 */
36

--- 225 unchanged lines hidden (view full) ---

262 * This flag is turned on by default. Drivers can turn it off according
263 * to their own requirement.
264 */
265#define VMBUS_CHAN_FLAG_BATCHREAD 0x0002
266
267#define VMBUS_CHAN_ST_OPENED_SHIFT 0
268#define VMBUS_CHAN_ST_OPENED (1 << VMBUS_CHAN_ST_OPENED_SHIFT)
269
29 */
30
31/**
32 * HyperV definitions for messages that are sent between instances of the
33 * Channel Management Library in separate partitions, or in some cases,
34 * back to itself.
35 */
36

--- 225 unchanged lines hidden (view full) ---

262 * This flag is turned on by default. Drivers can turn it off according
263 * to their own requirement.
264 */
265#define VMBUS_CHAN_FLAG_BATCHREAD 0x0002
266
267#define VMBUS_CHAN_ST_OPENED_SHIFT 0
268#define VMBUS_CHAN_ST_OPENED (1 << VMBUS_CHAN_ST_OPENED_SHIFT)
269
270static inline void
271hv_set_channel_read_state(hv_vmbus_channel* channel, boolean_t on)
272{
273 if (!on)
274 channel->ch_flags &= ~VMBUS_CHAN_FLAG_BATCHREAD;
275 else
276 channel->ch_flags |= VMBUS_CHAN_FLAG_BATCHREAD;
277}
278
279int hv_vmbus_channel_open(
280 hv_vmbus_channel* channel,
281 uint32_t send_ring_buffer_size,
282 uint32_t recv_ring_buffer_size,
283 void* user_data,
284 uint32_t user_data_len,
285 vmbus_chan_callback_t cb,
286 void *cbarg);
287
288void hv_vmbus_channel_close(hv_vmbus_channel *channel);
289
290int hv_vmbus_channel_teardown_gpdal(
291 hv_vmbus_channel* channel,
292 uint32_t gpadl_handle);
293
294int vmbus_chan_gpadl_connect(struct hv_vmbus_channel *chan,
295 bus_addr_t paddr, int size, uint32_t *gpadl);
296
297struct hv_vmbus_channel* vmbus_select_outgoing_channel(struct hv_vmbus_channel *promary);
298
299void vmbus_channel_cpu_set(struct hv_vmbus_channel *chan, int cpu);
300void vmbus_channel_cpu_rr(struct hv_vmbus_channel *chan);
301struct hv_vmbus_channel **
302 vmbus_get_subchan(struct hv_vmbus_channel *pri_chan, int subchan_cnt);
303void vmbus_rel_subchan(struct hv_vmbus_channel **subchan, int subchan_cnt);
304void vmbus_drain_subchan(struct hv_vmbus_channel *pri_chan);
305
306/**
307 * @brief Get physical address from virtual
308 */
309static inline unsigned long
310hv_get_phys_addr(void *virt)
311{
312 unsigned long ret;
313 ret = (vtophys(virt) | ((vm_offset_t) virt & PAGE_MASK));
314 return (ret);
315}
316
317static __inline struct hv_vmbus_channel *
318vmbus_get_channel(device_t dev)
319{
320 return device_get_ivars(dev);
321}
322
323#endif /* __HYPERV_H__ */
270/**
271 * @brief Get physical address from virtual
272 */
273static inline unsigned long
274hv_get_phys_addr(void *virt)
275{
276 unsigned long ret;
277 ret = (vtophys(virt) | ((vm_offset_t) virt & PAGE_MASK));
278 return (ret);
279}
280
281static __inline struct hv_vmbus_channel *
282vmbus_get_channel(device_t dev)
283{
284 return device_get_ivars(dev);
285}
286
287#endif /* __HYPERV_H__ */