aboutsummaryrefslogtreecommitdiffstats
path: root/arch/tile/gxio/iorpc_trio.c
blob: cef4b2209cda7351b84e893909fc7346e59ea479 (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
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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
/*
 * Copyright 2012 Tilera 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, version 2.
 *
 *   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.
 */

/* This file is machine-generated; DO NOT EDIT! */
#include "gxio/iorpc_trio.h"

struct alloc_asids_param {
	unsigned int count;
	unsigned int first;
	unsigned int flags;
};

int gxio_trio_alloc_asids(gxio_trio_context_t * context, unsigned int count,
			  unsigned int first, unsigned int flags)
{
	struct alloc_asids_param temp;
	struct alloc_asids_param *params = &temp;

	params->count = count;
	params->first = first;
	params->flags = flags;

	return hv_dev_pwrite(context->fd, 0, (HV_VirtAddr) params,
			     sizeof(*params), GXIO_TRIO_OP_ALLOC_ASIDS);
}

EXPORT_SYMBOL(gxio_trio_alloc_asids);


struct alloc_memory_maps_param {
	unsigned int count;
	unsigned int first;
	unsigned int flags;
};

int gxio_trio_alloc_memory_maps(gxio_trio_context_t * context,
				unsigned int count, unsigned int first,
				unsigned int flags)
{
	struct alloc_memory_maps_param temp;
	struct alloc_memory_maps_param *params = &temp;

	params->count = count;
	params->first = first;
	params->flags = flags;

	return hv_dev_pwrite(context->fd, 0, (HV_VirtAddr) params,
			     sizeof(*params), GXIO_TRIO_OP_ALLOC_MEMORY_MAPS);
}

EXPORT_SYMBOL(gxio_trio_alloc_memory_maps);


struct alloc_pio_regions_param {
	unsigned int count;
	unsigned int first;
	unsigned int flags;
};

int gxio_trio_alloc_pio_regions(gxio_trio_context_t * context,
				unsigned int count, unsigned int first,
				unsigned int flags)
{
	struct alloc_pio_regions_param temp;
	struct alloc_pio_regions_param *params = &temp;

	params->count = count;
	params->first = first;
	params->flags = flags;

	return hv_dev_pwrite(context->fd, 0, (HV_VirtAddr) params,
			     sizeof(*params), GXIO_TRIO_OP_ALLOC_PIO_REGIONS);
}

EXPORT_SYMBOL(gxio_trio_alloc_pio_regions);

struct init_pio_region_aux_param {
	unsigned int pio_region;
	unsigned int mac;
	uint32_t bus_address_hi;
	unsigned int flags;
};

int gxio_trio_init_pio_region_aux(gxio_trio_context_t * context,
				  unsigned int pio_region, unsigned int mac,
				  uint32_t bus_address_hi, unsigned int flags)
{
	struct init_pio_region_aux_param temp;
	struct init_pio_region_aux_param *params = &temp;

	params->pio_region = pio_region;
	params->mac = mac;
	params->bus_address_hi = bus_address_hi;
	params->flags = flags;

	return hv_dev_pwrite(context->fd, 0, (HV_VirtAddr) params,
			     sizeof(*params), GXIO_TRIO_OP_INIT_PIO_REGION_AUX);
}

EXPORT_SYMBOL(gxio_trio_init_pio_region_aux);


struct init_memory_map_mmu_aux_param {
	unsigned int map;
	unsigned long va;
	uint64_t size;
	unsigned int asid;
	unsigned int mac;
	uint64_t bus_address;
	unsigned int node;
	unsigned int order_mode;
};

int gxio_trio_init_memory_map_mmu_aux(gxio_trio_context_t * context,
				      unsigned int map, unsigned long va,
				      uint64_t size, unsigned int asid,
				      unsigned int mac, uint64_t bus_address,
				      unsigned int node,
				      unsigned int order_mode)
{
	struct init_memory_map_mmu_aux_param temp;
	struct init_memory_map_mmu_aux_param *params = &temp;

	params->map = map;
	params->va = va;
	params->size = size;
	params->asid = asid;
	params->mac = mac;
	params->bus_address = bus_address;
	params->node = node;
	params->order_mode = order_mode;

	return hv_dev_pwrite(context->fd, 0, (HV_VirtAddr) params,
			     sizeof(*params),
			     GXIO_TRIO_OP_INIT_MEMORY_MAP_MMU_AUX);
}

EXPORT_SYMBOL(gxio_trio_init_memory_map_mmu_aux);

struct get_port_property_param {
	struct pcie_trio_ports_property trio_ports;
};

int gxio_trio_get_port_property(gxio_trio_context_t * context,
				struct pcie_trio_ports_property *trio_ports)
{
	int __result;
	struct get_port_property_param temp;
	struct get_port_property_param *params = &temp;

	__result =
	    hv_dev_pread(context->fd, 0, (HV_VirtAddr) params, sizeof(*params),
			 GXIO_TRIO_OP_GET_PORT_PROPERTY);
	*trio_ports = params->trio_ports;

	return __result;
}

EXPORT_SYMBOL(gxio_trio_get_port_property);

struct config_legacy_intr_param {
	union iorpc_interrupt interrupt;
	unsigned int mac;
	unsigned int intx;
};

int gxio_trio_config_legacy_intr(gxio_trio_context_t * context, int inter_x,
				 int inter_y, int inter_ipi, int inter_event,
				 unsigned int mac, unsigned int intx)
{
	struct config_legacy_intr_param temp;
	struct config_legacy_intr_param *params = &temp;

	params->interrupt.kernel.x = inter_x;
	params->interrupt.kernel.y = inter_y;
	params->interrupt.kernel.ipi = inter_ipi;
	params->interrupt.kernel.event = inter_event;
	params->mac = mac;
	params->intx = intx;

	return hv_dev_pwrite(context->fd, 0, (HV_VirtAddr) params,
			     sizeof(*params), GXIO_TRIO_OP_CONFIG_LEGACY_INTR);
}

EXPORT_SYMBOL(gxio_trio_config_legacy_intr);

struct config_msi_intr_param {
	union iorpc_interrupt interrupt;
	unsigned int mac;
	unsigned int mem_map;
	uint64_t mem_map_base;
	uint64_t mem_map_limit;
	unsigned int asid;
};

int gxio_trio_config_msi_intr(gxio_trio_context_t * context, int inter_x,
			      int inter_y, int inter_ipi, int inter_event,
			      unsigned int mac, unsigned int mem_map,
			      uint64_t mem_map_base, uint64_t mem_map_limit,
			      unsigned int asid)
{
	struct config_msi_intr_param temp;
	struct config_msi_intr_param *params = &temp;

	params->interrupt.kernel.x = inter_x;
	params->interrupt.kernel.y = inter_y;
	params->interrupt.kernel.ipi = inter_ipi;
	params->interrupt.kernel.event = inter_event;
	params->mac = mac;
	params->mem_map = mem_map;
	params->mem_map_base = mem_map_base;
	params->mem_map_limit = mem_map_limit;
	params->asid = asid;

	return hv_dev_pwrite(context->fd, 0, (HV_VirtAddr) params,
			     sizeof(*params), GXIO_TRIO_OP_CONFIG_MSI_INTR);
}

EXPORT_SYMBOL(gxio_trio_config_msi_intr);


struct set_mps_mrs_param {
	uint16_t mps;
	uint16_t mrs;
	unsigned int mac;
};

int gxio_trio_set_mps_mrs(gxio_trio_context_t * context, uint16_t mps,
			  uint16_t mrs, unsigned int mac)
{
	struct set_mps_mrs_param temp;
	struct set_mps_mrs_param *params = &temp;

	params->mps = mps;
	params->mrs = mrs;
	params->mac = mac;

	return hv_dev_pwrite(context->fd, 0, (HV_VirtAddr) params,
			     sizeof(*params), GXIO_TRIO_OP_SET_MPS_MRS);
}

EXPORT_SYMBOL(gxio_trio_set_mps_mrs);

struct force_rc_link_up_param {
	unsigned int mac;
};

int gxio_trio_force_rc_link_up(gxio_trio_context_t * context, unsigned int mac)
{
	struct force_rc_link_up_param temp;
	struct force_rc_link_up_param *params = &temp;

	params->mac = mac;

	return hv_dev_pwrite(context->fd, 0, (HV_VirtAddr) params,
			     sizeof(*params), GXIO_TRIO_OP_FORCE_RC_LINK_UP);
}

EXPORT_SYMBOL(gxio_trio_force_rc_link_up);

struct force_ep_link_up_param {
	unsigned int mac;
};

int gxio_trio_force_ep_link_up(gxio_trio_context_t * context, unsigned int mac)
{
	struct force_ep_link_up_param temp;
	struct force_ep_link_up_param *params = &temp;

	params->mac = mac;

	return hv_dev_pwrite(context->fd, 0, (HV_VirtAddr) params,
			     sizeof(*params), GXIO_TRIO_OP_FORCE_EP_LINK_UP);
}

EXPORT_SYMBOL(gxio_trio_force_ep_link_up);

struct get_mmio_base_param {
	HV_PTE base;
};

int gxio_trio_get_mmio_base(gxio_trio_context_t * context, HV_PTE *base)
{
	int __result;
	struct get_mmio_base_param temp;
	struct get_mmio_base_param *params = &temp;

	__result =
	    hv_dev_pread(context->fd, 0, (HV_VirtAddr) params, sizeof(*params),
			 GXIO_TRIO_OP_GET_MMIO_BASE);
	*base = params->base;

	return __result;
}

EXPORT_SYMBOL(gxio_trio_get_mmio_base);

struct check_mmio_offset_param {
	unsigned long offset;
	unsigned long size;
};

int gxio_trio_check_mmio_offset(gxio_trio_context_t * context,
				unsigned long offset, unsigned long size)
{
	struct check_mmio_offset_param temp;
	struct check_mmio_offset_param *params = &temp;

	params->offset = offset;
	params->size = size;

	return hv_dev_pwrite(context->fd, 0, (HV_VirtAddr) params,
			     sizeof(*params), GXIO_TRIO_OP_CHECK_MMIO_OFFSET);
}

EXPORT_SYMBOL(gxio_trio_check_mmio_offset);