3 * Copyright (C) 2010 - 2013 UNISYS CORPORATION
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or (at
9 * your option) any later version.
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
14 * NON INFRINGEMENT. See the GNU General Public License for more
18 #ifndef __VISORCHIPSET_H__
19 #define __VISORCHIPSET_H__
21 #include <linux/uuid.h>
24 #include "controlvmchannel.h"
25 #include "vbusdeviceinfo.h"
26 #include "vbushelper.h"
30 /** Attributes for a particular Supervisor device.
31 * Any visorchipset client can query these attributes using
32 * visorchipset_get_client_device_info() or
33 * visorchipset_get_server_device_info().
35 struct visorchipset_device_info {
36 struct list_head entry;
39 uuid_le dev_inst_uuid;
40 struct visorchipset_state state;
41 struct visorchannel *visorchannel;
42 uuid_le channel_type_guid;
43 u32 reserved1; /* control_vm_id */
45 u32 switch_no; /* when devState.attached==1 */
46 u32 internal_port_no; /* when devState.attached==1 */
47 struct controlvm_message_header *pending_msg_hdr;/* CONTROLVM_MESSAGE */
48 /** For private use by the bus driver */
49 void *bus_driver_context;
52 /** Attributes for a particular Supervisor bus.
53 * (For a service partition acting as the server for buses/devices, there
54 * is a 1-to-1 relationship between busses and guest partitions.)
55 * Any visorchipset client can query these attributes using
56 * visorchipset_get_client_bus_info() or visorchipset_get_bus_info().
58 struct visorchipset_bus_info {
59 struct list_head entry;
61 struct visorchipset_state state;
62 struct visorchannel *visorchannel;
63 uuid_le partition_uuid;
66 u8 *description; /* UTF8 */
69 struct controlvm_message_header *pending_msg_hdr;/* CONTROLVM MsgHdr */
70 /** For private use by the bus driver */
71 void *bus_driver_context;
74 /* These functions will be called from within visorchipset when certain
75 * events happen. (The implementation of these functions is outside of
78 struct visorchipset_busdev_notifiers {
79 void (*bus_create)(struct visorchipset_bus_info *bus_info);
80 void (*bus_destroy)(struct visorchipset_bus_info *bus_info);
81 void (*device_create)(struct visorchipset_device_info *bus_info);
82 void (*device_destroy)(struct visorchipset_device_info *bus_info);
83 void (*device_pause)(struct visorchipset_device_info *bus_info);
84 void (*device_resume)(struct visorchipset_device_info *bus_info);
87 /* These functions live inside visorchipset, and will be called to indicate
88 * responses to specific events (by code outside of visorchipset).
89 * For now, the value for each response is simply either:
93 struct visorchipset_busdev_responders {
94 void (*bus_create)(struct visorchipset_bus_info *p, int response);
95 void (*bus_destroy)(struct visorchipset_bus_info *p, int response);
96 void (*device_create)(struct visorchipset_device_info *p, int response);
97 void (*device_destroy)(struct visorchipset_device_info *p,
99 void (*device_pause)(struct visorchipset_device_info *p, int response);
100 void (*device_resume)(struct visorchipset_device_info *p, int response);
103 /** Register functions (in the bus driver) to get called by visorchipset
104 * whenever a bus or device appears for which this guest is to be the
105 * client for. visorchipset will fill in <responders>, to indicate
106 * functions the bus driver should call to indicate message responses.
109 visorchipset_register_busdev(
110 struct visorchipset_busdev_notifiers *notifiers,
111 struct visorchipset_busdev_responders *responders,
112 struct ultra_vbus_deviceinfo *driver_info);
114 bool visorchipset_get_bus_info(u32 bus_no,
115 struct visorchipset_bus_info *bus_info);
116 bool visorchipset_get_device_info(u32 bus_no, u32 dev_no,
117 struct visorchipset_device_info *dev_info);
118 bool visorchipset_set_bus_context(struct visorchipset_bus_info *bus_info,
121 /* visorbus init and exit functions */
122 int visorbus_init(void);
123 void visorbus_exit(void);