]> git.karo-electronics.de Git - karo-tx-linux.git/blob - drivers/staging/unisys/visorbus/visorbus_private.h
staging: unisys: Remove unused cruft
[karo-tx-linux.git] / drivers / staging / unisys / visorbus / visorbus_private.h
1 /* visorchipset.h
2  *
3  * Copyright (C) 2010 - 2013 UNISYS CORPORATION
4  * All rights reserved.
5  *
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.
10  *
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
15  * details.
16  */
17
18 #ifndef __VISORCHIPSET_H__
19 #define __VISORCHIPSET_H__
20
21 #include <linux/uuid.h>
22
23 #include "channel.h"
24 #include "controlvmchannel.h"
25 #include "vbusdeviceinfo.h"
26 #include "vbushelper.h"
27
28 struct visorchannel;
29
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().
34  */
35 struct visorchipset_device_info {
36         struct list_head entry;
37         u32 bus_no;
38         u32 dev_no;
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 */
44         u64 reserved2;
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;
50 };
51
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().
57  */
58 struct visorchipset_bus_info {
59         struct list_head entry;
60         u32 bus_no;
61         struct visorchipset_state state;
62         struct visorchannel *visorchannel;
63         uuid_le partition_uuid;
64         u64 partition_handle;
65         u8 *name;               /* UTF8 */
66         u8 *description;        /* UTF8 */
67         u64 reserved1;
68         u32 reserved2;
69         struct {
70                 u32 server:1;
71                 /* Add new fields above. */
72                 /* Remaining bits in this 32-bit word are unused. */
73         } flags;
74         struct controlvm_message_header *pending_msg_hdr;/* CONTROLVM MsgHdr */
75         /** For private use by the bus driver */
76         void *bus_driver_context;
77 };
78
79 /*  These functions will be called from within visorchipset when certain
80  *  events happen.  (The implementation of these functions is outside of
81  *  visorchipset.)
82  */
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);
90 };
91
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:
95  *       0 = it worked
96  *      -1 = it failed
97  */
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,
103                                int response);
104         void (*device_pause)(struct visorchipset_device_info *p, int response);
105         void (*device_resume)(struct visorchipset_device_info *p, int response);
106 };
107
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.
112  */
113 void
114 visorchipset_register_busdev(
115                         struct visorchipset_busdev_notifiers *notifiers,
116                         struct visorchipset_busdev_responders *responders,
117                         struct ultra_vbus_deviceinfo *driver_info);
118
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,
124                                   void *context);
125
126 /* visorbus init and exit functions */
127 int visorbus_init(void);
128 void visorbus_exit(void);
129 #endif