aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/unisys/visorbus/visorbus_private.h
blob: 6fd55af8926c0fd164f79f67c11e51b866d5e5b7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
/* visorchipset.h
 *
 * Copyright (C) 2010 - 2013 UNISYS CORPORATION
 * All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or (at
 * your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
 * NON INFRINGEMENT.  See the GNU General Public License for more
 * details.
 */

#ifndef __VISORCHIPSET_H__
#define __VISORCHIPSET_H__

#include <linux/uuid.h>

#include "channel.h"
#include "controlvmchannel.h"
#include "vbusdeviceinfo.h"
#include "vbushelper.h"

struct visorchannel;

/** Attributes for a particular Supervisor device.
 *  Any visorchipset client can query these attributes using
 *  visorchipset_get_client_device_info() or
 *  visorchipset_get_server_device_info().
 */
struct visorchipset_device_info {
	struct list_head entry;
	u32 bus_no;
	u32 dev_no;
	uuid_le dev_inst_uuid;
	struct visorchipset_state state;
	struct visorchannel *visorchannel;
	uuid_le channel_type_guid;
	u32 reserved1;		/* control_vm_id */
	u64 reserved2;
	u32 switch_no;		/* when devState.attached==1 */
	u32 internal_port_no;	/* when devState.attached==1 */
	struct controlvm_message_header *pending_msg_hdr;/* CONTROLVM_MESSAGE */
	/** For private use by the bus driver */
	void *bus_driver_context;
};

/*  These functions will be called from within visorchipset when certain
 *  events happen.  (The implementation of these functions is outside of
 *  visorchipset.)
 */
struct visorchipset_busdev_notifiers {
	void (*bus_create)(struct visor_device *bus_info);
	void (*bus_destroy)(struct visor_device *bus_info);
	void (*device_create)(struct visorchipset_device_info *bus_info);
	void (*device_destroy)(struct visorchipset_device_info *bus_info);
	void (*device_pause)(struct visorchipset_device_info *bus_info);
	void (*device_resume)(struct visorchipset_device_info *bus_info);
};

/*  These functions live inside visorchipset, and will be called to indicate
 *  responses to specific events (by code outside of visorchipset).
 *  For now, the value for each response is simply either:
 *       0 = it worked
 *      -1 = it failed
 */
struct visorchipset_busdev_responders {
	void (*bus_create)(struct visor_device *p, int response);
	void (*bus_destroy)(struct visor_device *p, int response);
	void (*device_create)(struct visorchipset_device_info *p, int response);
	void (*device_destroy)(struct visorchipset_device_info *p,
			       int response);
	void (*device_pause)(struct visorchipset_device_info *p, int response);
	void (*device_resume)(struct visorchipset_device_info *p, int response);
};

/** Register functions (in the bus driver) to get called by visorchipset
 *  whenever a bus or device appears for which this guest is to be the
 *  client for.  visorchipset will fill in <responders>, to indicate
 *  functions the bus driver should call to indicate message responses.
 */
void
visorchipset_register_busdev(
			struct visorchipset_busdev_notifiers *notifiers,
			struct visorchipset_busdev_responders *responders,
			struct ultra_vbus_deviceinfo *driver_info);

bool visorchipset_get_bus_info(u32 bus_no,
			       struct visor_device *bus_info);
bool visorchipset_get_device_info(u32 bus_no, u32 dev_no,
				  struct visorchipset_device_info *dev_info);
bool visorchipset_set_bus_context(struct visor_device *bus_info,
				  void *context);

/* visorbus init and exit functions */
int visorbus_init(void);
void visorbus_exit(void);
#endif