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 */
71 /* Add new fields above. */
72 /* Remaining bits in this 32-bit word are unused. */
74 struct controlvm_message_header *pending_msg_hdr;/* CONTROLVM MsgHdr */
75 /** For private use by the bus driver */
76 void *bus_driver_context;
79 /* These functions will be called from within visorchipset when certain
80 * events happen. (The implementation of these functions is outside of
83 struct visorchipset_busdev_notifiers {
84 void (*bus_create)(struct visorchipset_bus_info *bus_info);
85 void (*bus_destroy)(struct visorchipset_bus_info *bus_info);
86 void (*device_create)(struct visorchipset_device_info *bus_info);
87 void (*device_destroy)(struct visorchipset_device_info *bus_info);
88 void (*device_pause)(struct visorchipset_device_info *bus_info);
89 void (*device_resume)(struct visorchipset_device_info *bus_info);
92 /* These functions live inside visorchipset, and will be called to indicate
93 * responses to specific events (by code outside of visorchipset).
94 * For now, the value for each response is simply either:
98 struct visorchipset_busdev_responders {
99 void (*bus_create)(struct visorchipset_bus_info *p, int response);
100 void (*bus_destroy)(struct visorchipset_bus_info *p, int response);
101 void (*device_create)(struct visorchipset_device_info *p, int response);
102 void (*device_destroy)(struct visorchipset_device_info *p,
104 void (*device_pause)(struct visorchipset_device_info *p, int response);
105 void (*device_resume)(struct visorchipset_device_info *p, int response);
108 /** Register functions (in the bus driver) to get called by visorchipset
109 * whenever a bus or device appears for which this guest is to be the
110 * client for. visorchipset will fill in <responders>, to indicate
111 * functions the bus driver should call to indicate message responses.
114 visorchipset_register_busdev(
115 struct visorchipset_busdev_notifiers *notifiers,
116 struct visorchipset_busdev_responders *responders,
117 struct ultra_vbus_deviceinfo *driver_info);
119 bool visorchipset_get_bus_info(u32 bus_no,
120 struct visorchipset_bus_info *bus_info);
121 bool visorchipset_get_device_info(u32 bus_no, u32 dev_no,
122 struct visorchipset_device_info *dev_info);
123 bool visorchipset_set_bus_context(struct visorchipset_bus_info *bus_info,
126 /* visorbus init and exit functions */
127 int visorbus_init(void);
128 void visorbus_exit(void);