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 "procobjecttree.h"
26 #include "vbusdeviceinfo.h"
27 #include "vbushelper.h"
31 struct visorchipset_state {
36 /* Add new fields above. */
37 /* Remaining bits in this 32-bit word are unused. */
40 enum visorchipset_addresstype {
41 /** address is guest physical, but outside of the physical memory
42 * region that is controlled by the running OS (this is the normal
43 * address type for Supervisor channels)
45 ADDRTYPE_LOCALPHYSICAL,
47 /** address is guest physical, and withIN the confines of the
48 * physical memory controlled by the running OS.
53 /** Attributes for a particular Supervisor channel.
55 struct visorchipset_channel_info {
56 enum visorchipset_addresstype addr_type;
57 HOSTADDRESS channel_addr;
60 uuid_le channel_type_uuid;
61 uuid_le channel_inst_uuid;
64 /** Attributes for a particular Supervisor device.
65 * Any visorchipset client can query these attributes using
66 * visorchipset_get_client_device_info() or
67 * visorchipset_get_server_device_info().
69 struct visorchipset_device_info {
70 struct list_head entry;
73 uuid_le dev_inst_uuid;
74 struct visorchipset_state state;
75 struct visorchipset_channel_info chan_info;
76 u32 reserved1; /* control_vm_id */
78 u32 switch_no; /* when devState.attached==1 */
79 u32 internal_port_no; /* when devState.attached==1 */
80 struct controlvm_message_header pending_msg_hdr;/* CONTROLVM_MESSAGE */
81 /** For private use by the bus driver */
82 void *bus_driver_context;
85 /** Attributes for a particular Supervisor bus.
86 * (For a service partition acting as the server for buses/devices, there
87 * is a 1-to-1 relationship between busses and guest partitions.)
88 * Any visorchipset client can query these attributes using
89 * visorchipset_get_client_bus_info() or visorchipset_get_bus_info().
91 struct visorchipset_bus_info {
92 struct list_head entry;
94 struct visorchipset_state state;
95 struct visorchipset_channel_info chan_info;
96 uuid_le partition_uuid;
99 u8 *description; /* UTF8 */
104 /* Add new fields above. */
105 /* Remaining bits in this 32-bit word are unused. */
107 struct controlvm_message_header pending_msg_hdr;/* CONTROLVM MsgHdr */
108 /** For private use by the bus driver */
109 void *bus_driver_context;
112 /* These functions will be called from within visorchipset when certain
113 * events happen. (The implementation of these functions is outside of
116 struct visorchipset_busdev_notifiers {
117 void (*bus_create)(u32 bus_no);
118 void (*bus_destroy)(u32 bus_no);
119 void (*device_create)(u32 bus_no, u32 dev_no);
120 void (*device_destroy)(u32 bus_no, u32 dev_no);
121 void (*device_pause)(u32 bus_no, u32 dev_no);
122 void (*device_resume)(u32 bus_no, u32 dev_no);
125 /* These functions live inside visorchipset, and will be called to indicate
126 * responses to specific events (by code outside of visorchipset).
127 * For now, the value for each response is simply either:
131 struct visorchipset_busdev_responders {
132 void (*bus_create)(u32 bus_no, int response);
133 void (*bus_destroy)(u32 bus_no, int response);
134 void (*device_create)(u32 bus_no, u32 dev_no, int response);
135 void (*device_destroy)(u32 bus_no, u32 dev_no, int response);
136 void (*device_pause)(u32 bus_no, u32 dev_no, int response);
137 void (*device_resume)(u32 bus_no, u32 dev_no, int response);
140 /** Register functions (in the bus driver) to get called by visorchipset
141 * whenever a bus or device appears for which this service partition is
142 * to be the client for. visorchipset will fill in <responders>, to
143 * indicate functions the bus driver should call to indicate message
147 visorchipset_register_busdev_server(
148 struct visorchipset_busdev_notifiers *notifiers,
149 struct visorchipset_busdev_responders *responders,
150 struct ultra_vbus_deviceinfo *driver_info);
152 bool visorchipset_get_bus_info(u32 bus_no,
153 struct visorchipset_bus_info *bus_info);
154 bool visorchipset_get_device_info(u32 bus_no, u32 dev_no,
155 struct visorchipset_device_info *dev_info);
156 bool visorchipset_set_bus_context(u32 bus_no, void *context);
158 /* visorbus init and exit functions */
159 int __init visorbus_init(void);
160 void visorbus_exit(void);