xref: /freebsd/sys/dev/hyperv/utilities/hv_utilreg.h (revision 95ee2897e98f5d444f26ed2334cc7c439f9c16c6)
14cd995ffSSepherosa Ziehau /*-
24cd995ffSSepherosa Ziehau  * Copyright (c) 2016 Microsoft Corp.
34cd995ffSSepherosa Ziehau  * All rights reserved.
44cd995ffSSepherosa Ziehau  *
54cd995ffSSepherosa Ziehau  * Redistribution and use in source and binary forms, with or without
64cd995ffSSepherosa Ziehau  * modification, are permitted provided that the following conditions
74cd995ffSSepherosa Ziehau  * are met:
84cd995ffSSepherosa Ziehau  * 1. Redistributions of source code must retain the above copyright
94cd995ffSSepherosa Ziehau  *    notice unmodified, this list of conditions, and the following
104cd995ffSSepherosa Ziehau  *    disclaimer.
114cd995ffSSepherosa Ziehau  * 2. Redistributions in binary form must reproduce the above copyright
124cd995ffSSepherosa Ziehau  *    notice, this list of conditions and the following disclaimer in the
134cd995ffSSepherosa Ziehau  *    documentation and/or other materials provided with the distribution.
144cd995ffSSepherosa Ziehau  *
154cd995ffSSepherosa Ziehau  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
164cd995ffSSepherosa Ziehau  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
174cd995ffSSepherosa Ziehau  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
184cd995ffSSepherosa Ziehau  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
194cd995ffSSepherosa Ziehau  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
204cd995ffSSepherosa Ziehau  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
214cd995ffSSepherosa Ziehau  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
224cd995ffSSepherosa Ziehau  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
234cd995ffSSepherosa Ziehau  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
244cd995ffSSepherosa Ziehau  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
254cd995ffSSepherosa Ziehau  */
264cd995ffSSepherosa Ziehau 
274cd995ffSSepherosa Ziehau #ifndef _HV_UTILREG_H_
284cd995ffSSepherosa Ziehau #define _HV_UTILREG_H_
294cd995ffSSepherosa Ziehau 
30*30c90f01SSepherosa Ziehau /*
31*30c90f01SSepherosa Ziehau  * Some Hyper-V status codes.
32*30c90f01SSepherosa Ziehau  */
334cd995ffSSepherosa Ziehau #define HV_S_OK				0x00000000
344cd995ffSSepherosa Ziehau #define HV_E_FAIL			0x80004005
35*30c90f01SSepherosa Ziehau #define HV_S_CONT			0x80070103
364cd995ffSSepherosa Ziehau #define HV_ERROR_NOT_SUPPORTED		0x80070032
374cd995ffSSepherosa Ziehau #define HV_ERROR_MACHINE_LOCKED		0x800704F7
38*30c90f01SSepherosa Ziehau #define HV_ERROR_DEVICE_NOT_CONNECTED	0x8007048F
39*30c90f01SSepherosa Ziehau #define HV_INVALIDARG			0x80070057
40*30c90f01SSepherosa Ziehau #define HV_GUID_NOTFOUND		0x80041002
414cd995ffSSepherosa Ziehau 
424cd995ffSSepherosa Ziehau /*
434cd995ffSSepherosa Ziehau  * Common defines for Hyper-V ICs
444cd995ffSSepherosa Ziehau  */
454cd995ffSSepherosa Ziehau #define HV_ICMSGTYPE_NEGOTIATE		0
464cd995ffSSepherosa Ziehau #define HV_ICMSGTYPE_HEARTBEAT		1
474cd995ffSSepherosa Ziehau #define HV_ICMSGTYPE_KVPEXCHANGE	2
484cd995ffSSepherosa Ziehau #define HV_ICMSGTYPE_SHUTDOWN		3
494cd995ffSSepherosa Ziehau #define HV_ICMSGTYPE_TIMESYNC		4
504cd995ffSSepherosa Ziehau #define HV_ICMSGTYPE_VSS		5
514cd995ffSSepherosa Ziehau 
524cd995ffSSepherosa Ziehau #define HV_ICMSGHDRFLAG_TRANSACTION	1
534cd995ffSSepherosa Ziehau #define HV_ICMSGHDRFLAG_REQUEST		2
544cd995ffSSepherosa Ziehau #define HV_ICMSGHDRFLAG_RESPONSE	4
554cd995ffSSepherosa Ziehau 
564cd995ffSSepherosa Ziehau typedef struct hv_vmbus_pipe_hdr {
574cd995ffSSepherosa Ziehau 	uint32_t flags;
584cd995ffSSepherosa Ziehau 	uint32_t msgsize;
594cd995ffSSepherosa Ziehau } __packed hv_vmbus_pipe_hdr;
604cd995ffSSepherosa Ziehau 
614cd995ffSSepherosa Ziehau typedef struct hv_vmbus_ic_version {
624cd995ffSSepherosa Ziehau 	uint16_t major;
634cd995ffSSepherosa Ziehau 	uint16_t minor;
644cd995ffSSepherosa Ziehau } __packed hv_vmbus_ic_version;
654cd995ffSSepherosa Ziehau 
664cd995ffSSepherosa Ziehau typedef struct hv_vmbus_icmsg_hdr {
674cd995ffSSepherosa Ziehau 	hv_vmbus_ic_version	icverframe;
684cd995ffSSepherosa Ziehau 	uint16_t		icmsgtype;
694cd995ffSSepherosa Ziehau 	hv_vmbus_ic_version	icvermsg;
704cd995ffSSepherosa Ziehau 	uint16_t		icmsgsize;
714cd995ffSSepherosa Ziehau 	uint32_t		status;
724cd995ffSSepherosa Ziehau 	uint8_t			ictransaction_id;
734cd995ffSSepherosa Ziehau 	uint8_t			icflags;
744cd995ffSSepherosa Ziehau 	uint8_t			reserved[2];
754cd995ffSSepherosa Ziehau } __packed hv_vmbus_icmsg_hdr;
764cd995ffSSepherosa Ziehau 
774cd995ffSSepherosa Ziehau typedef struct hv_vmbus_icmsg_negotiate {
784cd995ffSSepherosa Ziehau 	uint16_t		icframe_vercnt;
794cd995ffSSepherosa Ziehau 	uint16_t		icmsg_vercnt;
804cd995ffSSepherosa Ziehau 	uint32_t		reserved;
814cd995ffSSepherosa Ziehau 	hv_vmbus_ic_version	icversion_data[1]; /* any size array */
824cd995ffSSepherosa Ziehau } __packed hv_vmbus_icmsg_negotiate;
834cd995ffSSepherosa Ziehau 
844cd995ffSSepherosa Ziehau #endif	/* !_HV_UTILREG_H_ */
85