GNU Linux-libre 4.9.311-gnu1
[releases.git] / drivers / staging / unisys / visorbus / visorbus_private.h
1 /* visorbus_private.h
2  *
3  * Copyright (C) 2010 - 2015 UNISYS CORPORATION
4  * All rights reserved.
5  *
6  * This program is free software; you can redistribute it and/or modify it
7  * under the terms and conditions of the GNU General Public License,
8  * version 2, as published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
13  * NON INFRINGEMENT.  See the GNU General Public License for more
14  * details.
15  */
16
17 #ifndef __VISORBUS_PRIVATE_H__
18 #define __VISORBUS_PRIVATE_H__
19
20 #include <linux/uuid.h>
21 #include <linux/utsname.h>
22
23 #include "controlvmchannel.h"
24 #include "vbuschannel.h"
25
26 /* TARGET_HOSTNAME specified as -DTARGET_HOSTNAME=\"thename\" on the
27  * command line
28  */
29
30 static inline void bus_device_info_init(
31                 struct ultra_vbus_deviceinfo *bus_device_info_ptr,
32                 const char *dev_type, const char *drv_name)
33 {
34         memset(bus_device_info_ptr, 0, sizeof(struct ultra_vbus_deviceinfo));
35         snprintf(bus_device_info_ptr->devtype,
36                  sizeof(bus_device_info_ptr->devtype),
37                  "%s", (dev_type) ? dev_type : "unknownType");
38         snprintf(bus_device_info_ptr->drvname,
39                  sizeof(bus_device_info_ptr->drvname),
40                  "%s", (drv_name) ? drv_name : "unknownDriver");
41         snprintf(bus_device_info_ptr->infostrs,
42                  sizeof(bus_device_info_ptr->infostrs), "kernel ver. %s",
43                  utsname()->release);
44 }
45
46 void chipset_bus_create(struct visor_device *bus_info);
47 void chipset_bus_destroy(struct visor_device *bus_info);
48 void chipset_device_create(struct visor_device *dev_info);
49 void chipset_device_destroy(struct visor_device *dev_info);
50 void chipset_device_pause(struct visor_device *dev_info);
51 void chipset_device_resume(struct visor_device *dev_info);
52
53 void bus_create_response(struct visor_device *p, int response);
54 void bus_destroy_response(struct visor_device *p, int response);
55 void device_create_response(struct visor_device *p, int response);
56 void device_destroy_response(struct visor_device *p, int response);
57 void device_resume_response(struct visor_device *p, int response);
58 void device_pause_response(struct visor_device *p, int response);
59
60 int visorbus_init(void);
61 void visorbus_exit(void);
62
63 /* visorchannel access functions */
64
65 struct visorchannel *visorchannel_create(u64 physaddr,
66                                          unsigned long channel_bytes,
67                                          gfp_t gfp, uuid_le guid);
68 struct visorchannel *visorchannel_create_with_lock(u64 physaddr,
69                                                    unsigned long channel_bytes,
70                                                    gfp_t gfp, uuid_le guid);
71 void visorchannel_destroy(struct visorchannel *channel);
72 int visorchannel_read(struct visorchannel *channel, ulong offset,
73                       void *local, ulong nbytes);
74 int visorchannel_write(struct visorchannel *channel, ulong offset,
75                        void *local, ulong nbytes);
76 u64 visorchannel_get_physaddr(struct visorchannel *channel);
77 ulong visorchannel_get_nbytes(struct visorchannel *channel);
78 char *visorchannel_id(struct visorchannel *channel, char *s);
79 char *visorchannel_zoneid(struct visorchannel *channel, char *s);
80 u64 visorchannel_get_clientpartition(struct visorchannel *channel);
81 int visorchannel_set_clientpartition(struct visorchannel *channel,
82                                      u64 partition_handle);
83 char *visorchannel_uuid_id(uuid_le *guid, char *s);
84 void __iomem *visorchannel_get_header(struct visorchannel *channel);
85 #endif