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 9 * are met: 10 * 1. Redistributions of source code must retain the above copyright 11 * notice unmodified, this list of conditions, and the following 12 * disclaimer. 13 * 2. Redistributions in binary form must reproduce the above copyright 14 * notice, this list of conditions and the following disclaimer in the 15 * documentation and/or other materials provided with the distribution. 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 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$ 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 37 #ifndef __HYPERV_H__ 38 #define __HYPERV_H__ 39 40 #include <sys/param.h> 41 #include <sys/mbuf.h> 42 #include <sys/queue.h> 43 #include <sys/malloc.h> 44 #include <sys/kthread.h> 45 #include <sys/taskqueue.h> 46 #include <sys/systm.h> 47 #include <sys/lock.h> 48 #include <sys/sema.h> 49 #include <sys/smp.h> 50 #include <sys/mutex.h> 51 #include <sys/bus.h> 52 #include <sys/sysctl.h> 53 #include <vm/vm.h> 54 #include <vm/vm_param.h> 55 #include <vm/pmap.h> 56 57 #include <amd64/include/xen/synch_bitops.h> 58 #include <amd64/include/atomic.h> 59 #include <dev/hyperv/include/hyperv_busdma.h> 60 61 struct hyperv_guid { 62 uint8_t hv_guid[16]; 63 } __packed; 64 65 #define HYPERV_GUID_STRLEN 40 66 67 int hyperv_guid2str(const struct hyperv_guid *, char *, size_t); 68 69 /** 70 * @brief Get physical address from virtual 71 */ 72 static inline unsigned long 73 hv_get_phys_addr(void *virt) 74 { 75 unsigned long ret; 76 ret = (vtophys(virt) | ((vm_offset_t) virt & PAGE_MASK)); 77 return (ret); 78 } 79 80 #endif /* __HYPERV_H__ */ 81