summaryrefslogtreecommitdiff
path: root/include/linux/vbus_pci.h
blob: fe337590e644017392e4c9d9236150adb2333729 (plain)
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
/*
 * Copyright 2009 Novell.  All Rights Reserved.
 *
 * PCI to Virtual-Bus Bridge
 *
 * Author:
 *      Gregory Haskins <ghaskins@novell.com>
 *
 * This file is free software; you can redistribute it and/or modify
 * it under the terms of version 2 of the GNU General Public License
 * as published by the Free Software Foundation.
 *
 * 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.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
 */

#ifndef _LINUX_VBUS_PCI_H
#define _LINUX_VBUS_PCI_H

#include <linux/ioctl.h>
#include <linux/types.h>

#define VBUS_PCI_ABI_MAGIC 0xbf53eef5
#define VBUS_PCI_ABI_VERSION 2
#define VBUS_PCI_HC_VERSION 1

enum {
	VBUS_PCI_BRIDGE_NEGOTIATE,
	VBUS_PCI_BRIDGE_QREG,
	VBUS_PCI_BRIDGE_SLOWCALL,
	VBUS_PCI_BRIDGE_FASTCALL_ADD,
	VBUS_PCI_BRIDGE_FASTCALL_DROP,

	VBUS_PCI_BRIDGE_MAX, /* must be last */
};

enum {
	VBUS_PCI_HC_DEVOPEN,
	VBUS_PCI_HC_DEVCLOSE,
	VBUS_PCI_HC_DEVCALL,
	VBUS_PCI_HC_DEVSHM,

	VBUS_PCI_HC_MAX,      /* must be last */
};

struct vbus_pci_bridge_negotiate {
	__u32 magic;
	__u32 version;
	__u64 capabilities;
};

struct vbus_pci_deviceopen {
	__u32 devid;
	__u32 version; /* device ABI version */
	__u64 handle; /* return value for devh */
};

struct vbus_pci_devicecall {
	__u64 devh;   /* device-handle (returned from DEVICEOPEN */
	__u32 func;
	__u32 len;
	__u32 flags;
	__u64 datap;
};

struct vbus_pci_deviceshm {
	__u64 devh;   /* device-handle (returned from DEVICEOPEN */
	__u32 id;
	__u32 len;
	__u32 flags;
	struct {
		__u32 offset;
		__u32 prio;
		__u64 cookie; /* token to pass back when signaling client */
	} signal;
	__u64 datap;
};

struct vbus_pci_call_desc {
	__u32 vector;
	__u32 len;
	__u64 datap;
};

struct vbus_pci_fastcall_desc {
	struct vbus_pci_call_desc call;
	__u32                     result;
};

struct vbus_pci_regs {
	struct vbus_pci_call_desc bridgecall;
	__u8                      pad[48];
};

struct vbus_pci_signals {
	__u32 eventq;
	__u32 fastcall;
	__u32 shmsignal;
	__u8  pad[20];
};

struct vbus_pci_eventqreg {
	__u32 count;
	__u64 ring;
	__u64 data;
};

struct vbus_pci_busreg {
	__u32 count;  /* supporting multiple queues allows for prio, etc */
	struct vbus_pci_eventqreg eventq[1];
};

enum vbus_pci_eventid {
	VBUS_PCI_EVENT_DEVADD,
	VBUS_PCI_EVENT_DEVDROP,
	VBUS_PCI_EVENT_SHMSIGNAL,
	VBUS_PCI_EVENT_SHMCLOSE,
};

#define VBUS_MAX_DEVTYPE_LEN 128

struct vbus_pci_add_event {
	__u64 id;
	char  type[VBUS_MAX_DEVTYPE_LEN];
};

struct vbus_pci_handle_event {
	__u64 handle;
};

struct vbus_pci_event {
	__u32 eventid;
	union {
		struct vbus_pci_add_event    add;
		struct vbus_pci_handle_event handle;
	} data;
};

#endif /* _LINUX_VBUS_PCI_H */