18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Copyright (C) 2010 - 2015 UNISYS CORPORATION
48c2ecf20Sopenharmony_ci * All rights reserved.
58c2ecf20Sopenharmony_ci */
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci#ifndef __VBUSCHANNEL_H__
88c2ecf20Sopenharmony_ci#define __VBUSCHANNEL_H__
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci/*
118c2ecf20Sopenharmony_ci * The vbus channel is the channel area provided via the BUS_CREATE controlvm
128c2ecf20Sopenharmony_ci * message for each virtual bus.  This channel area is provided to both server
138c2ecf20Sopenharmony_ci * and client ends of the bus.  The channel header area is initialized by
148c2ecf20Sopenharmony_ci * the server, and the remaining information is filled in by the client.
158c2ecf20Sopenharmony_ci * We currently use this for the client to provide various information about
168c2ecf20Sopenharmony_ci * the client devices and client drivers for the server end to see.
178c2ecf20Sopenharmony_ci */
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci#include <linux/uuid.h>
208c2ecf20Sopenharmony_ci#include <linux/visorbus.h>
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ci/* {193b331b-c58f-11da-95a9-00e08161165f} */
238c2ecf20Sopenharmony_ci#define VISOR_VBUS_CHANNEL_GUID						\
248c2ecf20Sopenharmony_ci	GUID_INIT(0x193b331b, 0xc58f, 0x11da,				\
258c2ecf20Sopenharmony_ci		  0x95, 0xa9, 0x0, 0xe0, 0x81, 0x61, 0x16, 0x5f)
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_ci/*
288c2ecf20Sopenharmony_ci * Must increment this whenever you insert or delete fields within this channel
298c2ecf20Sopenharmony_ci * struct.  Also increment whenever you change the meaning of fields within this
308c2ecf20Sopenharmony_ci * channel struct so as to break pre-existing software.  Note that you can
318c2ecf20Sopenharmony_ci * usually add fields to the END of the channel struct withOUT needing to
328c2ecf20Sopenharmony_ci * increment this.
338c2ecf20Sopenharmony_ci */
348c2ecf20Sopenharmony_ci#define VISOR_VBUS_CHANNEL_VERSIONID 1
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ci/*
378c2ecf20Sopenharmony_ci * struct visor_vbus_deviceinfo
388c2ecf20Sopenharmony_ci * @devtype:  Short string identifying the device type.
398c2ecf20Sopenharmony_ci * @drvname:  Driver .sys file name.
408c2ecf20Sopenharmony_ci * @infostrs: Kernel vversion.
418c2ecf20Sopenharmony_ci * @reserved: Pad size to 256 bytes.
428c2ecf20Sopenharmony_ci *
438c2ecf20Sopenharmony_ci * An array of this struct is present in the channel area for each vbus. It is
448c2ecf20Sopenharmony_ci * filled in by the client side to provide info about the device and driver from
458c2ecf20Sopenharmony_ci * the client's perspective.
468c2ecf20Sopenharmony_ci */
478c2ecf20Sopenharmony_cistruct visor_vbus_deviceinfo {
488c2ecf20Sopenharmony_ci	u8 devtype[16];
498c2ecf20Sopenharmony_ci	u8 drvname[16];
508c2ecf20Sopenharmony_ci	u8 infostrs[96];
518c2ecf20Sopenharmony_ci	u8 reserved[128];
528c2ecf20Sopenharmony_ci} __packed;
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_ci/*
558c2ecf20Sopenharmony_ci * struct visor_vbus_headerinfo
568c2ecf20Sopenharmony_ci * @struct_bytes:	      Size of this struct in bytes.
578c2ecf20Sopenharmony_ci * @device_info_struct_bytes: Size of VISOR_VBUS_DEVICEINFO.
588c2ecf20Sopenharmony_ci * @dev_info_count:	      Num of items in DevInfo member. This is the
598c2ecf20Sopenharmony_ci *			      allocated size.
608c2ecf20Sopenharmony_ci * @chp_info_offset:	      Byte offset from beginning of this struct to the
618c2ecf20Sopenharmony_ci *			      ChpInfo struct.
628c2ecf20Sopenharmony_ci * @bus_info_offset:	      Byte offset from beginning of this struct to the
638c2ecf20Sopenharmony_ci *			      BusInfo struct.
648c2ecf20Sopenharmony_ci * @dev_info_offset:	      Byte offset from beginning of this struct to the
658c2ecf20Sopenharmony_ci *			      DevInfo array.
668c2ecf20Sopenharmony_ci * @reserved:		      Natural alignment.
678c2ecf20Sopenharmony_ci */
688c2ecf20Sopenharmony_cistruct visor_vbus_headerinfo {
698c2ecf20Sopenharmony_ci	u32 struct_bytes;
708c2ecf20Sopenharmony_ci	u32 device_info_struct_bytes;
718c2ecf20Sopenharmony_ci	u32 dev_info_count;
728c2ecf20Sopenharmony_ci	u32 chp_info_offset;
738c2ecf20Sopenharmony_ci	u32 bus_info_offset;
748c2ecf20Sopenharmony_ci	u32 dev_info_offset;
758c2ecf20Sopenharmony_ci	u8 reserved[104];
768c2ecf20Sopenharmony_ci} __packed;
778c2ecf20Sopenharmony_ci
788c2ecf20Sopenharmony_ci/*
798c2ecf20Sopenharmony_ci * struct visor_vbus_channel
808c2ecf20Sopenharmony_ci * @channel_header: Initialized by server.
818c2ecf20Sopenharmony_ci * @hdr_info:	    Initialized by server.
828c2ecf20Sopenharmony_ci * @chp_info:	    Describes client chipset device and driver.
838c2ecf20Sopenharmony_ci * @bus_info:	    Describes client bus device and driver.
848c2ecf20Sopenharmony_ci * @dev_info:	    Describes client device and driver for each device on the
858c2ecf20Sopenharmony_ci *		    bus.
868c2ecf20Sopenharmony_ci */
878c2ecf20Sopenharmony_cistruct visor_vbus_channel {
888c2ecf20Sopenharmony_ci	struct channel_header channel_header;
898c2ecf20Sopenharmony_ci	struct visor_vbus_headerinfo hdr_info;
908c2ecf20Sopenharmony_ci	struct visor_vbus_deviceinfo chp_info;
918c2ecf20Sopenharmony_ci	struct visor_vbus_deviceinfo bus_info;
928c2ecf20Sopenharmony_ci	struct visor_vbus_deviceinfo dev_info[0];
938c2ecf20Sopenharmony_ci} __packed;
948c2ecf20Sopenharmony_ci
958c2ecf20Sopenharmony_ci#endif
96