18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: (GPL-2.0 OR CDDL-1.0) */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Virtual Device for Guest <-> VMM/Host communication interface
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright (C) 2006-2016 Oracle Corporation
68c2ecf20Sopenharmony_ci */
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci#ifndef __VBOX_VMMDEV_H__
98c2ecf20Sopenharmony_ci#define __VBOX_VMMDEV_H__
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#include <asm/bitsperlong.h>
128c2ecf20Sopenharmony_ci#include <linux/sizes.h>
138c2ecf20Sopenharmony_ci#include <linux/types.h>
148c2ecf20Sopenharmony_ci#include <linux/vbox_vmmdev_types.h>
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci/* Port for generic request interface (relative offset). */
178c2ecf20Sopenharmony_ci#define VMMDEV_PORT_OFF_REQUEST                             0
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci/** Layout of VMMDEV RAM region that contains information for guest. */
208c2ecf20Sopenharmony_cistruct vmmdev_memory {
218c2ecf20Sopenharmony_ci	/** The size of this structure. */
228c2ecf20Sopenharmony_ci	u32 size;
238c2ecf20Sopenharmony_ci	/** The structure version. (VMMDEV_MEMORY_VERSION) */
248c2ecf20Sopenharmony_ci	u32 version;
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci	union {
278c2ecf20Sopenharmony_ci		struct {
288c2ecf20Sopenharmony_ci			/** Flag telling that VMMDev has events pending. */
298c2ecf20Sopenharmony_ci			u8 have_events;
308c2ecf20Sopenharmony_ci			/** Explicit padding, MBZ. */
318c2ecf20Sopenharmony_ci			u8 padding[3];
328c2ecf20Sopenharmony_ci		} V1_04;
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci		struct {
358c2ecf20Sopenharmony_ci			/** Pending events flags, set by host. */
368c2ecf20Sopenharmony_ci			u32 host_events;
378c2ecf20Sopenharmony_ci			/** Mask of events the guest wants, set by guest. */
388c2ecf20Sopenharmony_ci			u32 guest_event_mask;
398c2ecf20Sopenharmony_ci		} V1_03;
408c2ecf20Sopenharmony_ci	} V;
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_ci	/* struct vbva_memory, not used */
438c2ecf20Sopenharmony_ci};
448c2ecf20Sopenharmony_ciVMMDEV_ASSERT_SIZE(vmmdev_memory, 8 + 8);
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_ci/** Version of vmmdev_memory structure (vmmdev_memory::version). */
478c2ecf20Sopenharmony_ci#define VMMDEV_MEMORY_VERSION   (1)
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_ci/* Host mouse capabilities has been changed. */
508c2ecf20Sopenharmony_ci#define VMMDEV_EVENT_MOUSE_CAPABILITIES_CHANGED             BIT(0)
518c2ecf20Sopenharmony_ci/* HGCM event. */
528c2ecf20Sopenharmony_ci#define VMMDEV_EVENT_HGCM                                   BIT(1)
538c2ecf20Sopenharmony_ci/* A display change request has been issued. */
548c2ecf20Sopenharmony_ci#define VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST                 BIT(2)
558c2ecf20Sopenharmony_ci/* Credentials are available for judgement. */
568c2ecf20Sopenharmony_ci#define VMMDEV_EVENT_JUDGE_CREDENTIALS                      BIT(3)
578c2ecf20Sopenharmony_ci/* The guest has been restored. */
588c2ecf20Sopenharmony_ci#define VMMDEV_EVENT_RESTORED                               BIT(4)
598c2ecf20Sopenharmony_ci/* Seamless mode state changed. */
608c2ecf20Sopenharmony_ci#define VMMDEV_EVENT_SEAMLESS_MODE_CHANGE_REQUEST           BIT(5)
618c2ecf20Sopenharmony_ci/* Memory balloon size changed. */
628c2ecf20Sopenharmony_ci#define VMMDEV_EVENT_BALLOON_CHANGE_REQUEST                 BIT(6)
638c2ecf20Sopenharmony_ci/* Statistics interval changed. */
648c2ecf20Sopenharmony_ci#define VMMDEV_EVENT_STATISTICS_INTERVAL_CHANGE_REQUEST     BIT(7)
658c2ecf20Sopenharmony_ci/* VRDP status changed. */
668c2ecf20Sopenharmony_ci#define VMMDEV_EVENT_VRDP                                   BIT(8)
678c2ecf20Sopenharmony_ci/* New mouse position data available. */
688c2ecf20Sopenharmony_ci#define VMMDEV_EVENT_MOUSE_POSITION_CHANGED                 BIT(9)
698c2ecf20Sopenharmony_ci/* CPU hotplug event occurred. */
708c2ecf20Sopenharmony_ci#define VMMDEV_EVENT_CPU_HOTPLUG                            BIT(10)
718c2ecf20Sopenharmony_ci/* The mask of valid events, for sanity checking. */
728c2ecf20Sopenharmony_ci#define VMMDEV_EVENT_VALID_EVENT_MASK                       0x000007ffU
738c2ecf20Sopenharmony_ci
748c2ecf20Sopenharmony_ci/*
758c2ecf20Sopenharmony_ci * Additions are allowed to work only if additions_major == vmmdev_current &&
768c2ecf20Sopenharmony_ci * additions_minor <= vmmdev_current. Additions version is reported to host
778c2ecf20Sopenharmony_ci * (VMMDev) by VMMDEVREQ_REPORT_GUEST_INFO.
788c2ecf20Sopenharmony_ci */
798c2ecf20Sopenharmony_ci#define VMMDEV_VERSION                      0x00010004
808c2ecf20Sopenharmony_ci#define VMMDEV_VERSION_MAJOR                (VMMDEV_VERSION >> 16)
818c2ecf20Sopenharmony_ci#define VMMDEV_VERSION_MINOR                (VMMDEV_VERSION & 0xffff)
828c2ecf20Sopenharmony_ci
838c2ecf20Sopenharmony_ci/* Maximum request packet size. */
848c2ecf20Sopenharmony_ci#define VMMDEV_MAX_VMMDEVREQ_SIZE           1048576
858c2ecf20Sopenharmony_ci
868c2ecf20Sopenharmony_ci/* Version of vmmdev_request_header structure. */
878c2ecf20Sopenharmony_ci#define VMMDEV_REQUEST_HEADER_VERSION       0x10001
888c2ecf20Sopenharmony_ci
898c2ecf20Sopenharmony_ci/** struct vmmdev_request_header - Generic VMMDev request header. */
908c2ecf20Sopenharmony_cistruct vmmdev_request_header {
918c2ecf20Sopenharmony_ci	/** IN: Size of the structure in bytes (including body). */
928c2ecf20Sopenharmony_ci	u32 size;
938c2ecf20Sopenharmony_ci	/** IN: Version of the structure.  */
948c2ecf20Sopenharmony_ci	u32 version;
958c2ecf20Sopenharmony_ci	/** IN: Type of the request. */
968c2ecf20Sopenharmony_ci	enum vmmdev_request_type request_type;
978c2ecf20Sopenharmony_ci	/** OUT: Return code. */
988c2ecf20Sopenharmony_ci	s32 rc;
998c2ecf20Sopenharmony_ci	/** Reserved field no.1. MBZ. */
1008c2ecf20Sopenharmony_ci	u32 reserved1;
1018c2ecf20Sopenharmony_ci	/** IN: Requestor information (VMMDEV_REQUESTOR_*) */
1028c2ecf20Sopenharmony_ci	u32 requestor;
1038c2ecf20Sopenharmony_ci};
1048c2ecf20Sopenharmony_ciVMMDEV_ASSERT_SIZE(vmmdev_request_header, 24);
1058c2ecf20Sopenharmony_ci
1068c2ecf20Sopenharmony_ci/**
1078c2ecf20Sopenharmony_ci * struct vmmdev_mouse_status - Mouse status request structure.
1088c2ecf20Sopenharmony_ci *
1098c2ecf20Sopenharmony_ci * Used by VMMDEVREQ_GET_MOUSE_STATUS and VMMDEVREQ_SET_MOUSE_STATUS.
1108c2ecf20Sopenharmony_ci */
1118c2ecf20Sopenharmony_cistruct vmmdev_mouse_status {
1128c2ecf20Sopenharmony_ci	/** header */
1138c2ecf20Sopenharmony_ci	struct vmmdev_request_header header;
1148c2ecf20Sopenharmony_ci	/** Mouse feature mask. See VMMDEV_MOUSE_*. */
1158c2ecf20Sopenharmony_ci	u32 mouse_features;
1168c2ecf20Sopenharmony_ci	/** Mouse x position. */
1178c2ecf20Sopenharmony_ci	s32 pointer_pos_x;
1188c2ecf20Sopenharmony_ci	/** Mouse y position. */
1198c2ecf20Sopenharmony_ci	s32 pointer_pos_y;
1208c2ecf20Sopenharmony_ci};
1218c2ecf20Sopenharmony_ciVMMDEV_ASSERT_SIZE(vmmdev_mouse_status, 24 + 12);
1228c2ecf20Sopenharmony_ci
1238c2ecf20Sopenharmony_ci/* The guest can (== wants to) handle absolute coordinates.  */
1248c2ecf20Sopenharmony_ci#define VMMDEV_MOUSE_GUEST_CAN_ABSOLUTE                     BIT(0)
1258c2ecf20Sopenharmony_ci/*
1268c2ecf20Sopenharmony_ci * The host can (== wants to) send absolute coordinates.
1278c2ecf20Sopenharmony_ci * (Input not captured.)
1288c2ecf20Sopenharmony_ci */
1298c2ecf20Sopenharmony_ci#define VMMDEV_MOUSE_HOST_WANTS_ABSOLUTE                    BIT(1)
1308c2ecf20Sopenharmony_ci/*
1318c2ecf20Sopenharmony_ci * The guest can *NOT* switch to software cursor and therefore depends on the
1328c2ecf20Sopenharmony_ci * host cursor.
1338c2ecf20Sopenharmony_ci *
1348c2ecf20Sopenharmony_ci * When guest additions are installed and the host has promised to display the
1358c2ecf20Sopenharmony_ci * cursor itself, the guest installs a hardware mouse driver. Don't ask the
1368c2ecf20Sopenharmony_ci * guest to switch to a software cursor then.
1378c2ecf20Sopenharmony_ci */
1388c2ecf20Sopenharmony_ci#define VMMDEV_MOUSE_GUEST_NEEDS_HOST_CURSOR                BIT(2)
1398c2ecf20Sopenharmony_ci/* The host does NOT provide support for drawing the cursor itself. */
1408c2ecf20Sopenharmony_ci#define VMMDEV_MOUSE_HOST_CANNOT_HWPOINTER                  BIT(3)
1418c2ecf20Sopenharmony_ci/* The guest can read VMMDev events to find out about pointer movement */
1428c2ecf20Sopenharmony_ci#define VMMDEV_MOUSE_NEW_PROTOCOL                           BIT(4)
1438c2ecf20Sopenharmony_ci/*
1448c2ecf20Sopenharmony_ci * If the guest changes the status of the VMMDEV_MOUSE_GUEST_NEEDS_HOST_CURSOR
1458c2ecf20Sopenharmony_ci * bit, the host will honour this.
1468c2ecf20Sopenharmony_ci */
1478c2ecf20Sopenharmony_ci#define VMMDEV_MOUSE_HOST_RECHECKS_NEEDS_HOST_CURSOR        BIT(5)
1488c2ecf20Sopenharmony_ci/*
1498c2ecf20Sopenharmony_ci * The host supplies an absolute pointing device.  The Guest Additions may
1508c2ecf20Sopenharmony_ci * wish to use this to decide whether to install their own driver.
1518c2ecf20Sopenharmony_ci */
1528c2ecf20Sopenharmony_ci#define VMMDEV_MOUSE_HOST_HAS_ABS_DEV                       BIT(6)
1538c2ecf20Sopenharmony_ci
1548c2ecf20Sopenharmony_ci/* The minimum value our pointing device can return. */
1558c2ecf20Sopenharmony_ci#define VMMDEV_MOUSE_RANGE_MIN 0
1568c2ecf20Sopenharmony_ci/* The maximum value our pointing device can return. */
1578c2ecf20Sopenharmony_ci#define VMMDEV_MOUSE_RANGE_MAX 0xFFFF
1588c2ecf20Sopenharmony_ci
1598c2ecf20Sopenharmony_ci/**
1608c2ecf20Sopenharmony_ci * struct vmmdev_host_version - VirtualBox host version request structure.
1618c2ecf20Sopenharmony_ci *
1628c2ecf20Sopenharmony_ci * VBG uses this to detect the precense of new features in the interface.
1638c2ecf20Sopenharmony_ci */
1648c2ecf20Sopenharmony_cistruct vmmdev_host_version {
1658c2ecf20Sopenharmony_ci	/** Header. */
1668c2ecf20Sopenharmony_ci	struct vmmdev_request_header header;
1678c2ecf20Sopenharmony_ci	/** Major version. */
1688c2ecf20Sopenharmony_ci	u16 major;
1698c2ecf20Sopenharmony_ci	/** Minor version. */
1708c2ecf20Sopenharmony_ci	u16 minor;
1718c2ecf20Sopenharmony_ci	/** Build number. */
1728c2ecf20Sopenharmony_ci	u32 build;
1738c2ecf20Sopenharmony_ci	/** SVN revision. */
1748c2ecf20Sopenharmony_ci	u32 revision;
1758c2ecf20Sopenharmony_ci	/** Feature mask. */
1768c2ecf20Sopenharmony_ci	u32 features;
1778c2ecf20Sopenharmony_ci};
1788c2ecf20Sopenharmony_ciVMMDEV_ASSERT_SIZE(vmmdev_host_version, 24 + 16);
1798c2ecf20Sopenharmony_ci
1808c2ecf20Sopenharmony_ci/* Physical page lists are supported by HGCM. */
1818c2ecf20Sopenharmony_ci#define VMMDEV_HVF_HGCM_PHYS_PAGE_LIST  BIT(0)
1828c2ecf20Sopenharmony_ci
1838c2ecf20Sopenharmony_ci/**
1848c2ecf20Sopenharmony_ci * struct vmmdev_mask - Structure to set / clear bits in a mask used for
1858c2ecf20Sopenharmony_ci * VMMDEVREQ_SET_GUEST_CAPABILITIES and VMMDEVREQ_CTL_GUEST_FILTER_MASK.
1868c2ecf20Sopenharmony_ci */
1878c2ecf20Sopenharmony_cistruct vmmdev_mask {
1888c2ecf20Sopenharmony_ci	/** Header. */
1898c2ecf20Sopenharmony_ci	struct vmmdev_request_header header;
1908c2ecf20Sopenharmony_ci	/** Mask of bits to be set. */
1918c2ecf20Sopenharmony_ci	u32 or_mask;
1928c2ecf20Sopenharmony_ci	/** Mask of bits to be cleared. */
1938c2ecf20Sopenharmony_ci	u32 not_mask;
1948c2ecf20Sopenharmony_ci};
1958c2ecf20Sopenharmony_ciVMMDEV_ASSERT_SIZE(vmmdev_mask, 24 + 8);
1968c2ecf20Sopenharmony_ci
1978c2ecf20Sopenharmony_ci/* The guest supports seamless display rendering. */
1988c2ecf20Sopenharmony_ci#define VMMDEV_GUEST_SUPPORTS_SEAMLESS                      BIT(0)
1998c2ecf20Sopenharmony_ci/* The guest supports mapping guest to host windows. */
2008c2ecf20Sopenharmony_ci#define VMMDEV_GUEST_SUPPORTS_GUEST_HOST_WINDOW_MAPPING     BIT(1)
2018c2ecf20Sopenharmony_ci/*
2028c2ecf20Sopenharmony_ci * The guest graphical additions are active.
2038c2ecf20Sopenharmony_ci * Used for fast activation and deactivation of certain graphical operations
2048c2ecf20Sopenharmony_ci * (e.g. resizing & seamless). The legacy VMMDEVREQ_REPORT_GUEST_CAPABILITIES
2058c2ecf20Sopenharmony_ci * request sets this automatically, but VMMDEVREQ_SET_GUEST_CAPABILITIES does
2068c2ecf20Sopenharmony_ci * not.
2078c2ecf20Sopenharmony_ci */
2088c2ecf20Sopenharmony_ci#define VMMDEV_GUEST_SUPPORTS_GRAPHICS                      BIT(2)
2098c2ecf20Sopenharmony_ci/* The mask of valid capabilities, for sanity checking. */
2108c2ecf20Sopenharmony_ci#define VMMDEV_GUEST_CAPABILITIES_MASK                      0x00000007U
2118c2ecf20Sopenharmony_ci
2128c2ecf20Sopenharmony_ci/** struct vmmdev_hypervisorinfo - Hypervisor info structure. */
2138c2ecf20Sopenharmony_cistruct vmmdev_hypervisorinfo {
2148c2ecf20Sopenharmony_ci	/** Header. */
2158c2ecf20Sopenharmony_ci	struct vmmdev_request_header header;
2168c2ecf20Sopenharmony_ci	/**
2178c2ecf20Sopenharmony_ci	 * Guest virtual address of proposed hypervisor start.
2188c2ecf20Sopenharmony_ci	 * Not used by VMMDEVREQ_GET_HYPERVISOR_INFO.
2198c2ecf20Sopenharmony_ci	 */
2208c2ecf20Sopenharmony_ci	u32 hypervisor_start;
2218c2ecf20Sopenharmony_ci	/** Hypervisor size in bytes. */
2228c2ecf20Sopenharmony_ci	u32 hypervisor_size;
2238c2ecf20Sopenharmony_ci};
2248c2ecf20Sopenharmony_ciVMMDEV_ASSERT_SIZE(vmmdev_hypervisorinfo, 24 + 8);
2258c2ecf20Sopenharmony_ci
2268c2ecf20Sopenharmony_ci/** struct vmmdev_events - Pending events structure. */
2278c2ecf20Sopenharmony_cistruct vmmdev_events {
2288c2ecf20Sopenharmony_ci	/** Header. */
2298c2ecf20Sopenharmony_ci	struct vmmdev_request_header header;
2308c2ecf20Sopenharmony_ci	/** OUT: Pending event mask. */
2318c2ecf20Sopenharmony_ci	u32 events;
2328c2ecf20Sopenharmony_ci};
2338c2ecf20Sopenharmony_ciVMMDEV_ASSERT_SIZE(vmmdev_events, 24 + 4);
2348c2ecf20Sopenharmony_ci
2358c2ecf20Sopenharmony_ci#define VMMDEV_OSTYPE_LINUX26		0x53000
2368c2ecf20Sopenharmony_ci#define VMMDEV_OSTYPE_X64		BIT(8)
2378c2ecf20Sopenharmony_ci
2388c2ecf20Sopenharmony_ci/** struct vmmdev_guestinfo - Guest information report. */
2398c2ecf20Sopenharmony_cistruct vmmdev_guest_info {
2408c2ecf20Sopenharmony_ci	/** Header. */
2418c2ecf20Sopenharmony_ci	struct vmmdev_request_header header;
2428c2ecf20Sopenharmony_ci	/**
2438c2ecf20Sopenharmony_ci	 * The VMMDev interface version expected by additions.
2448c2ecf20Sopenharmony_ci	 * *Deprecated*, do not use anymore! Will be removed.
2458c2ecf20Sopenharmony_ci	 */
2468c2ecf20Sopenharmony_ci	u32 interface_version;
2478c2ecf20Sopenharmony_ci	/** Guest OS type. */
2488c2ecf20Sopenharmony_ci	u32 os_type;
2498c2ecf20Sopenharmony_ci};
2508c2ecf20Sopenharmony_ciVMMDEV_ASSERT_SIZE(vmmdev_guest_info, 24 + 8);
2518c2ecf20Sopenharmony_ci
2528c2ecf20Sopenharmony_ci#define VMMDEV_GUEST_INFO2_ADDITIONS_FEATURES_REQUESTOR_INFO	BIT(0)
2538c2ecf20Sopenharmony_ci
2548c2ecf20Sopenharmony_ci/** struct vmmdev_guestinfo2 - Guest information report, version 2. */
2558c2ecf20Sopenharmony_cistruct vmmdev_guest_info2 {
2568c2ecf20Sopenharmony_ci	/** Header. */
2578c2ecf20Sopenharmony_ci	struct vmmdev_request_header header;
2588c2ecf20Sopenharmony_ci	/** Major version. */
2598c2ecf20Sopenharmony_ci	u16 additions_major;
2608c2ecf20Sopenharmony_ci	/** Minor version. */
2618c2ecf20Sopenharmony_ci	u16 additions_minor;
2628c2ecf20Sopenharmony_ci	/** Build number. */
2638c2ecf20Sopenharmony_ci	u32 additions_build;
2648c2ecf20Sopenharmony_ci	/** SVN revision. */
2658c2ecf20Sopenharmony_ci	u32 additions_revision;
2668c2ecf20Sopenharmony_ci	/** Feature mask. */
2678c2ecf20Sopenharmony_ci	u32 additions_features;
2688c2ecf20Sopenharmony_ci	/**
2698c2ecf20Sopenharmony_ci	 * The intentional meaning of this field was:
2708c2ecf20Sopenharmony_ci	 * Some additional information, for example 'Beta 1' or something like
2718c2ecf20Sopenharmony_ci	 * that.
2728c2ecf20Sopenharmony_ci	 *
2738c2ecf20Sopenharmony_ci	 * The way it was implemented was implemented: VBG_VERSION_STRING.
2748c2ecf20Sopenharmony_ci	 *
2758c2ecf20Sopenharmony_ci	 * This means the first three members are duplicated in this field (if
2768c2ecf20Sopenharmony_ci	 * the guest build config is sane). So, the user must check this and
2778c2ecf20Sopenharmony_ci	 * chop it off before usage. There is, because of the Main code's blind
2788c2ecf20Sopenharmony_ci	 * trust in the field's content, no way back.
2798c2ecf20Sopenharmony_ci	 */
2808c2ecf20Sopenharmony_ci	char name[128];
2818c2ecf20Sopenharmony_ci};
2828c2ecf20Sopenharmony_ciVMMDEV_ASSERT_SIZE(vmmdev_guest_info2, 24 + 144);
2838c2ecf20Sopenharmony_ci
2848c2ecf20Sopenharmony_cienum vmmdev_guest_facility_type {
2858c2ecf20Sopenharmony_ci	VBOXGUEST_FACILITY_TYPE_UNKNOWN          = 0,
2868c2ecf20Sopenharmony_ci	VBOXGUEST_FACILITY_TYPE_VBOXGUEST_DRIVER = 20,
2878c2ecf20Sopenharmony_ci	/* VBoxGINA / VBoxCredProv / pam_vbox. */
2888c2ecf20Sopenharmony_ci	VBOXGUEST_FACILITY_TYPE_AUTO_LOGON       = 90,
2898c2ecf20Sopenharmony_ci	VBOXGUEST_FACILITY_TYPE_VBOX_SERVICE     = 100,
2908c2ecf20Sopenharmony_ci	/* VBoxTray (Windows), VBoxClient (Linux, Unix). */
2918c2ecf20Sopenharmony_ci	VBOXGUEST_FACILITY_TYPE_VBOX_TRAY_CLIENT = 101,
2928c2ecf20Sopenharmony_ci	VBOXGUEST_FACILITY_TYPE_SEAMLESS         = 1000,
2938c2ecf20Sopenharmony_ci	VBOXGUEST_FACILITY_TYPE_GRAPHICS         = 1100,
2948c2ecf20Sopenharmony_ci	VBOXGUEST_FACILITY_TYPE_ALL              = 0x7ffffffe,
2958c2ecf20Sopenharmony_ci	/* Ensure the enum is a 32 bit data-type */
2968c2ecf20Sopenharmony_ci	VBOXGUEST_FACILITY_TYPE_SIZEHACK         = 0x7fffffff
2978c2ecf20Sopenharmony_ci};
2988c2ecf20Sopenharmony_ci
2998c2ecf20Sopenharmony_cienum vmmdev_guest_facility_status {
3008c2ecf20Sopenharmony_ci	VBOXGUEST_FACILITY_STATUS_INACTIVE    = 0,
3018c2ecf20Sopenharmony_ci	VBOXGUEST_FACILITY_STATUS_PAUSED      = 1,
3028c2ecf20Sopenharmony_ci	VBOXGUEST_FACILITY_STATUS_PRE_INIT    = 20,
3038c2ecf20Sopenharmony_ci	VBOXGUEST_FACILITY_STATUS_INIT        = 30,
3048c2ecf20Sopenharmony_ci	VBOXGUEST_FACILITY_STATUS_ACTIVE      = 50,
3058c2ecf20Sopenharmony_ci	VBOXGUEST_FACILITY_STATUS_TERMINATING = 100,
3068c2ecf20Sopenharmony_ci	VBOXGUEST_FACILITY_STATUS_TERMINATED  = 101,
3078c2ecf20Sopenharmony_ci	VBOXGUEST_FACILITY_STATUS_FAILED      = 800,
3088c2ecf20Sopenharmony_ci	VBOXGUEST_FACILITY_STATUS_UNKNOWN     = 999,
3098c2ecf20Sopenharmony_ci	/* Ensure the enum is a 32 bit data-type */
3108c2ecf20Sopenharmony_ci	VBOXGUEST_FACILITY_STATUS_SIZEHACK    = 0x7fffffff
3118c2ecf20Sopenharmony_ci};
3128c2ecf20Sopenharmony_ci
3138c2ecf20Sopenharmony_ci/** struct vmmdev_guest_status - Guest Additions status structure. */
3148c2ecf20Sopenharmony_cistruct vmmdev_guest_status {
3158c2ecf20Sopenharmony_ci	/** Header. */
3168c2ecf20Sopenharmony_ci	struct vmmdev_request_header header;
3178c2ecf20Sopenharmony_ci	/** Facility the status is indicated for. */
3188c2ecf20Sopenharmony_ci	enum vmmdev_guest_facility_type facility;
3198c2ecf20Sopenharmony_ci	/** Current guest status. */
3208c2ecf20Sopenharmony_ci	enum vmmdev_guest_facility_status status;
3218c2ecf20Sopenharmony_ci	/** Flags, not used at the moment. */
3228c2ecf20Sopenharmony_ci	u32 flags;
3238c2ecf20Sopenharmony_ci};
3248c2ecf20Sopenharmony_ciVMMDEV_ASSERT_SIZE(vmmdev_guest_status, 24 + 12);
3258c2ecf20Sopenharmony_ci
3268c2ecf20Sopenharmony_ci#define VMMDEV_MEMORY_BALLOON_CHUNK_SIZE             (1048576)
3278c2ecf20Sopenharmony_ci#define VMMDEV_MEMORY_BALLOON_CHUNK_PAGES            (1048576 / 4096)
3288c2ecf20Sopenharmony_ci
3298c2ecf20Sopenharmony_ci/** struct vmmdev_memballoon_info - Memory-balloon info structure. */
3308c2ecf20Sopenharmony_cistruct vmmdev_memballoon_info {
3318c2ecf20Sopenharmony_ci	/** Header. */
3328c2ecf20Sopenharmony_ci	struct vmmdev_request_header header;
3338c2ecf20Sopenharmony_ci	/** Balloon size in megabytes. */
3348c2ecf20Sopenharmony_ci	u32 balloon_chunks;
3358c2ecf20Sopenharmony_ci	/** Guest ram size in megabytes. */
3368c2ecf20Sopenharmony_ci	u32 phys_mem_chunks;
3378c2ecf20Sopenharmony_ci	/**
3388c2ecf20Sopenharmony_ci	 * Setting this to VMMDEV_EVENT_BALLOON_CHANGE_REQUEST indicates that
3398c2ecf20Sopenharmony_ci	 * the request is a response to that event.
3408c2ecf20Sopenharmony_ci	 * (Don't confuse this with VMMDEVREQ_ACKNOWLEDGE_EVENTS.)
3418c2ecf20Sopenharmony_ci	 */
3428c2ecf20Sopenharmony_ci	u32 event_ack;
3438c2ecf20Sopenharmony_ci};
3448c2ecf20Sopenharmony_ciVMMDEV_ASSERT_SIZE(vmmdev_memballoon_info, 24 + 12);
3458c2ecf20Sopenharmony_ci
3468c2ecf20Sopenharmony_ci/** struct vmmdev_memballoon_change - Change the size of the balloon. */
3478c2ecf20Sopenharmony_cistruct vmmdev_memballoon_change {
3488c2ecf20Sopenharmony_ci	/** Header. */
3498c2ecf20Sopenharmony_ci	struct vmmdev_request_header header;
3508c2ecf20Sopenharmony_ci	/** The number of pages in the array. */
3518c2ecf20Sopenharmony_ci	u32 pages;
3528c2ecf20Sopenharmony_ci	/** true = inflate, false = deflate.  */
3538c2ecf20Sopenharmony_ci	u32 inflate;
3548c2ecf20Sopenharmony_ci	/** Physical address (u64) of each page. */
3558c2ecf20Sopenharmony_ci	u64 phys_page[VMMDEV_MEMORY_BALLOON_CHUNK_PAGES];
3568c2ecf20Sopenharmony_ci};
3578c2ecf20Sopenharmony_ci
3588c2ecf20Sopenharmony_ci/** struct vmmdev_write_core_dump - Write Core Dump request data. */
3598c2ecf20Sopenharmony_cistruct vmmdev_write_core_dump {
3608c2ecf20Sopenharmony_ci	/** Header. */
3618c2ecf20Sopenharmony_ci	struct vmmdev_request_header header;
3628c2ecf20Sopenharmony_ci	/** Flags (reserved, MBZ). */
3638c2ecf20Sopenharmony_ci	u32 flags;
3648c2ecf20Sopenharmony_ci};
3658c2ecf20Sopenharmony_ciVMMDEV_ASSERT_SIZE(vmmdev_write_core_dump, 24 + 4);
3668c2ecf20Sopenharmony_ci
3678c2ecf20Sopenharmony_ci/** struct vmmdev_heartbeat - Heart beat check state structure. */
3688c2ecf20Sopenharmony_cistruct vmmdev_heartbeat {
3698c2ecf20Sopenharmony_ci	/** Header. */
3708c2ecf20Sopenharmony_ci	struct vmmdev_request_header header;
3718c2ecf20Sopenharmony_ci	/** OUT: Guest heartbeat interval in nanosec. */
3728c2ecf20Sopenharmony_ci	u64 interval_ns;
3738c2ecf20Sopenharmony_ci	/** Heartbeat check flag. */
3748c2ecf20Sopenharmony_ci	u8 enabled;
3758c2ecf20Sopenharmony_ci	/** Explicit padding, MBZ. */
3768c2ecf20Sopenharmony_ci	u8 padding[3];
3778c2ecf20Sopenharmony_ci} __packed;
3788c2ecf20Sopenharmony_ciVMMDEV_ASSERT_SIZE(vmmdev_heartbeat, 24 + 12);
3798c2ecf20Sopenharmony_ci
3808c2ecf20Sopenharmony_ci#define VMMDEV_HGCM_REQ_DONE      BIT(0)
3818c2ecf20Sopenharmony_ci#define VMMDEV_HGCM_REQ_CANCELLED BIT(1)
3828c2ecf20Sopenharmony_ci
3838c2ecf20Sopenharmony_ci/** struct vmmdev_hgcmreq_header - vmmdev HGCM requests header. */
3848c2ecf20Sopenharmony_cistruct vmmdev_hgcmreq_header {
3858c2ecf20Sopenharmony_ci	/** Request header. */
3868c2ecf20Sopenharmony_ci	struct vmmdev_request_header header;
3878c2ecf20Sopenharmony_ci
3888c2ecf20Sopenharmony_ci	/** HGCM flags. */
3898c2ecf20Sopenharmony_ci	u32 flags;
3908c2ecf20Sopenharmony_ci
3918c2ecf20Sopenharmony_ci	/** Result code. */
3928c2ecf20Sopenharmony_ci	s32 result;
3938c2ecf20Sopenharmony_ci};
3948c2ecf20Sopenharmony_ciVMMDEV_ASSERT_SIZE(vmmdev_hgcmreq_header, 24 + 8);
3958c2ecf20Sopenharmony_ci
3968c2ecf20Sopenharmony_ci/** struct vmmdev_hgcm_connect - HGCM connect request structure. */
3978c2ecf20Sopenharmony_cistruct vmmdev_hgcm_connect {
3988c2ecf20Sopenharmony_ci	/** HGCM request header. */
3998c2ecf20Sopenharmony_ci	struct vmmdev_hgcmreq_header header;
4008c2ecf20Sopenharmony_ci
4018c2ecf20Sopenharmony_ci	/** IN: Description of service to connect to. */
4028c2ecf20Sopenharmony_ci	struct vmmdev_hgcm_service_location loc;
4038c2ecf20Sopenharmony_ci
4048c2ecf20Sopenharmony_ci	/** OUT: Client identifier assigned by local instance of HGCM. */
4058c2ecf20Sopenharmony_ci	u32 client_id;
4068c2ecf20Sopenharmony_ci};
4078c2ecf20Sopenharmony_ciVMMDEV_ASSERT_SIZE(vmmdev_hgcm_connect, 32 + 132 + 4);
4088c2ecf20Sopenharmony_ci
4098c2ecf20Sopenharmony_ci/** struct vmmdev_hgcm_disconnect - HGCM disconnect request structure. */
4108c2ecf20Sopenharmony_cistruct vmmdev_hgcm_disconnect {
4118c2ecf20Sopenharmony_ci	/** HGCM request header. */
4128c2ecf20Sopenharmony_ci	struct vmmdev_hgcmreq_header header;
4138c2ecf20Sopenharmony_ci
4148c2ecf20Sopenharmony_ci	/** IN: Client identifier. */
4158c2ecf20Sopenharmony_ci	u32 client_id;
4168c2ecf20Sopenharmony_ci};
4178c2ecf20Sopenharmony_ciVMMDEV_ASSERT_SIZE(vmmdev_hgcm_disconnect, 32 + 4);
4188c2ecf20Sopenharmony_ci
4198c2ecf20Sopenharmony_ci#define VMMDEV_HGCM_MAX_PARMS 32
4208c2ecf20Sopenharmony_ci
4218c2ecf20Sopenharmony_ci/** struct vmmdev_hgcm_call - HGCM call request structure. */
4228c2ecf20Sopenharmony_cistruct vmmdev_hgcm_call {
4238c2ecf20Sopenharmony_ci	/* request header */
4248c2ecf20Sopenharmony_ci	struct vmmdev_hgcmreq_header header;
4258c2ecf20Sopenharmony_ci
4268c2ecf20Sopenharmony_ci	/** IN: Client identifier. */
4278c2ecf20Sopenharmony_ci	u32 client_id;
4288c2ecf20Sopenharmony_ci	/** IN: Service function number. */
4298c2ecf20Sopenharmony_ci	u32 function;
4308c2ecf20Sopenharmony_ci	/** IN: Number of parameters. */
4318c2ecf20Sopenharmony_ci	u32 parm_count;
4328c2ecf20Sopenharmony_ci	/** Parameters follow in form: HGCMFunctionParameter32|64 parms[X]; */
4338c2ecf20Sopenharmony_ci};
4348c2ecf20Sopenharmony_ciVMMDEV_ASSERT_SIZE(vmmdev_hgcm_call, 32 + 12);
4358c2ecf20Sopenharmony_ci
4368c2ecf20Sopenharmony_ci/**
4378c2ecf20Sopenharmony_ci * struct vmmdev_hgcm_cancel2 - HGCM cancel request structure, version 2.
4388c2ecf20Sopenharmony_ci *
4398c2ecf20Sopenharmony_ci * After the request header.rc will be:
4408c2ecf20Sopenharmony_ci *
4418c2ecf20Sopenharmony_ci * VINF_SUCCESS when cancelled.
4428c2ecf20Sopenharmony_ci * VERR_NOT_FOUND if the specified request cannot be found.
4438c2ecf20Sopenharmony_ci * VERR_INVALID_PARAMETER if the address is invalid valid.
4448c2ecf20Sopenharmony_ci */
4458c2ecf20Sopenharmony_cistruct vmmdev_hgcm_cancel2 {
4468c2ecf20Sopenharmony_ci	/** Header. */
4478c2ecf20Sopenharmony_ci	struct vmmdev_request_header header;
4488c2ecf20Sopenharmony_ci	/** The physical address of the request to cancel. */
4498c2ecf20Sopenharmony_ci	u32 phys_req_to_cancel;
4508c2ecf20Sopenharmony_ci};
4518c2ecf20Sopenharmony_ciVMMDEV_ASSERT_SIZE(vmmdev_hgcm_cancel2, 24 + 4);
4528c2ecf20Sopenharmony_ci
4538c2ecf20Sopenharmony_ci#endif
454