blob: c8d675c40f5efcde0e41a95684ac79a630b328e2 [file] [log] [blame]
Stephen Rothwell45dc76a2005-06-21 17:15:33 -07001/*
2 * Provides the Hypervisor PCI calls for iSeries Linux Parition.
3 * Copyright (C) 2001 <Wayne G Holm> <IBM Corporation>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the:
17 * Free Software Foundation, Inc.,
18 * 59 Temple Place, Suite 330,
19 * Boston, MA 02111-1307 USA
20 *
21 * Change Activity:
22 * Created, Jan 9, 2001
23 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070024
25#ifndef _HVCALLPCI_H
26#define _HVCALLPCI_H
27
28#include <asm/iSeries/HvCallSc.h>
29#include <asm/iSeries/HvTypes.h>
30
31/*
32 * DSA == Direct Select Address
33 * this struct must be 64 bits in total
34 */
35struct HvCallPci_DsaAddr {
36 u16 busNumber; /* PHB index? */
Stephen Rothwell45dc76a2005-06-21 17:15:33 -070037 u8 subBusNumber; /* PCI bus number? */
38 u8 deviceId; /* device and function? */
Linus Torvalds1da177e2005-04-16 15:20:36 -070039 u8 barNumber;
40 u8 reserved[3];
41};
42
43union HvDsaMap {
44 u64 DsaAddr;
45 struct HvCallPci_DsaAddr Dsa;
46};
47
48struct HvCallPci_LoadReturn {
49 u64 rc;
50 u64 value;
51};
52
53enum HvCallPci_DeviceType {
54 HvCallPci_NodeDevice = 1,
Stephen Rothwell45dc76a2005-06-21 17:15:33 -070055 HvCallPci_SpDevice = 2,
56 HvCallPci_IopDevice = 3,
57 HvCallPci_BridgeDevice = 4,
58 HvCallPci_MultiFunctionDevice = 5,
59 HvCallPci_IoaDevice = 6
Linus Torvalds1da177e2005-04-16 15:20:36 -070060};
61
62
63struct HvCallPci_DeviceInfo {
Stephen Rothwell45dc76a2005-06-21 17:15:33 -070064 u32 deviceType; /* See DeviceType enum for values */
Linus Torvalds1da177e2005-04-16 15:20:36 -070065};
Stephen Rothwell45dc76a2005-06-21 17:15:33 -070066
Linus Torvalds1da177e2005-04-16 15:20:36 -070067struct HvCallPci_BusUnitInfo {
Stephen Rothwell45dc76a2005-06-21 17:15:33 -070068 u32 sizeReturned; /* length of data returned */
69 u32 deviceType; /* see DeviceType enum for values */
Linus Torvalds1da177e2005-04-16 15:20:36 -070070};
71
72struct HvCallPci_BridgeInfo {
Stephen Rothwell45dc76a2005-06-21 17:15:33 -070073 struct HvCallPci_BusUnitInfo busUnitInfo; /* Generic bus unit info */
74 u8 subBusNumber; /* Bus number of secondary bus */
75 u8 maxAgents; /* Max idsels on secondary bus */
76 u8 maxSubBusNumber; /* Max Sub Bus */
77 u8 logicalSlotNumber; /* Logical Slot Number for IOA */
Linus Torvalds1da177e2005-04-16 15:20:36 -070078};
Linus Torvalds1da177e2005-04-16 15:20:36 -070079
Stephen Rothwell45dc76a2005-06-21 17:15:33 -070080
81/*
82 * Maximum BusUnitInfo buffer size. Provided for clients so
83 * they can allocate a buffer big enough for any type of bus
84 * unit. Increase as needed.
85 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070086enum {HvCallPci_MaxBusUnitInfoSize = 128};
87
88struct HvCallPci_BarParms {
89 u64 vaddr;
90 u64 raddr;
91 u64 size;
92 u64 protectStart;
93 u64 protectEnd;
94 u64 relocationOffset;
Stephen Rothwell45dc76a2005-06-21 17:15:33 -070095 u64 pciAddress;
Linus Torvalds1da177e2005-04-16 15:20:36 -070096 u64 reserved[3];
Stephen Rothwell45dc76a2005-06-21 17:15:33 -070097};
Linus Torvalds1da177e2005-04-16 15:20:36 -070098
99enum HvCallPci_VpdType {
Stephen Rothwell45dc76a2005-06-21 17:15:33 -0700100 HvCallPci_BusVpd = 1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700101 HvCallPci_BusAdapterVpd = 2
102};
103
104#define HvCallPciConfigLoad8 HvCallPci + 0
105#define HvCallPciConfigLoad16 HvCallPci + 1
106#define HvCallPciConfigLoad32 HvCallPci + 2
107#define HvCallPciConfigStore8 HvCallPci + 3
108#define HvCallPciConfigStore16 HvCallPci + 4
109#define HvCallPciConfigStore32 HvCallPci + 5
110#define HvCallPciEoi HvCallPci + 16
111#define HvCallPciGetBarParms HvCallPci + 18
112#define HvCallPciMaskFisr HvCallPci + 20
113#define HvCallPciUnmaskFisr HvCallPci + 21
114#define HvCallPciSetSlotReset HvCallPci + 25
115#define HvCallPciGetDeviceInfo HvCallPci + 27
116#define HvCallPciGetCardVpd HvCallPci + 28
117#define HvCallPciBarLoad8 HvCallPci + 40
118#define HvCallPciBarLoad16 HvCallPci + 41
119#define HvCallPciBarLoad32 HvCallPci + 42
120#define HvCallPciBarLoad64 HvCallPci + 43
121#define HvCallPciBarStore8 HvCallPci + 44
122#define HvCallPciBarStore16 HvCallPci + 45
123#define HvCallPciBarStore32 HvCallPci + 46
124#define HvCallPciBarStore64 HvCallPci + 47
125#define HvCallPciMaskInterrupts HvCallPci + 48
126#define HvCallPciUnmaskInterrupts HvCallPci + 49
127#define HvCallPciGetBusUnitInfo HvCallPci + 50
128
Linus Torvalds1da177e2005-04-16 15:20:36 -0700129static inline u64 HvCallPci_configLoad8(u16 busNumber, u8 subBusNumber,
Stephen Rothwell45dc76a2005-06-21 17:15:33 -0700130 u8 deviceId, u32 offset, u8 *value)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700131{
132 struct HvCallPci_DsaAddr dsa;
133 struct HvCallPci_LoadReturn retVal;
134
Stephen Rothwell45dc76a2005-06-21 17:15:33 -0700135 *((u64*)&dsa) = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700136
137 dsa.busNumber = busNumber;
138 dsa.subBusNumber = subBusNumber;
139 dsa.deviceId = deviceId;
140
141 HvCall3Ret16(HvCallPciConfigLoad8, &retVal, *(u64 *)&dsa, offset, 0);
142
Linus Torvalds1da177e2005-04-16 15:20:36 -0700143 *value = retVal.value;
144
145 return retVal.rc;
146}
Stephen Rothwell45dc76a2005-06-21 17:15:33 -0700147
Linus Torvalds1da177e2005-04-16 15:20:36 -0700148static inline u64 HvCallPci_configLoad16(u16 busNumber, u8 subBusNumber,
Stephen Rothwell45dc76a2005-06-21 17:15:33 -0700149 u8 deviceId, u32 offset, u16 *value)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700150{
151 struct HvCallPci_DsaAddr dsa;
152 struct HvCallPci_LoadReturn retVal;
153
Stephen Rothwell45dc76a2005-06-21 17:15:33 -0700154 *((u64*)&dsa) = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700155
156 dsa.busNumber = busNumber;
157 dsa.subBusNumber = subBusNumber;
158 dsa.deviceId = deviceId;
159
160 HvCall3Ret16(HvCallPciConfigLoad16, &retVal, *(u64 *)&dsa, offset, 0);
161
Linus Torvalds1da177e2005-04-16 15:20:36 -0700162 *value = retVal.value;
163
164 return retVal.rc;
165}
Stephen Rothwell45dc76a2005-06-21 17:15:33 -0700166
167static inline u64 HvCallPci_configLoad32(u16 busNumber, u8 subBusNumber,
168 u8 deviceId, u32 offset, u32 *value)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700169{
170 struct HvCallPci_DsaAddr dsa;
171 struct HvCallPci_LoadReturn retVal;
172
Stephen Rothwell45dc76a2005-06-21 17:15:33 -0700173 *((u64*)&dsa) = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700174
175 dsa.busNumber = busNumber;
176 dsa.subBusNumber = subBusNumber;
177 dsa.deviceId = deviceId;
178
179 HvCall3Ret16(HvCallPciConfigLoad32, &retVal, *(u64 *)&dsa, offset, 0);
180
Linus Torvalds1da177e2005-04-16 15:20:36 -0700181 *value = retVal.value;
182
183 return retVal.rc;
184}
Stephen Rothwell45dc76a2005-06-21 17:15:33 -0700185
186static inline u64 HvCallPci_configStore8(u16 busNumber, u8 subBusNumber,
187 u8 deviceId, u32 offset, u8 value)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700188{
189 struct HvCallPci_DsaAddr dsa;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700190
Stephen Rothwell45dc76a2005-06-21 17:15:33 -0700191 *((u64*)&dsa) = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700192
193 dsa.busNumber = busNumber;
194 dsa.subBusNumber = subBusNumber;
195 dsa.deviceId = deviceId;
196
Stephen Rothwell6b7feec2005-06-21 17:15:35 -0700197 return HvCall4(HvCallPciConfigStore8, *(u64 *)&dsa, offset, value, 0);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700198}
Stephen Rothwell45dc76a2005-06-21 17:15:33 -0700199
200static inline u64 HvCallPci_configStore16(u16 busNumber, u8 subBusNumber,
201 u8 deviceId, u32 offset, u16 value)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700202{
203 struct HvCallPci_DsaAddr dsa;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700204
Stephen Rothwell45dc76a2005-06-21 17:15:33 -0700205 *((u64*)&dsa) = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700206
207 dsa.busNumber = busNumber;
208 dsa.subBusNumber = subBusNumber;
209 dsa.deviceId = deviceId;
210
Stephen Rothwell6b7feec2005-06-21 17:15:35 -0700211 return HvCall4(HvCallPciConfigStore16, *(u64 *)&dsa, offset, value, 0);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700212}
Stephen Rothwell45dc76a2005-06-21 17:15:33 -0700213
214static inline u64 HvCallPci_configStore32(u16 busNumber, u8 subBusNumber,
215 u8 deviceId, u32 offset, u32 value)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700216{
217 struct HvCallPci_DsaAddr dsa;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700218
Stephen Rothwell45dc76a2005-06-21 17:15:33 -0700219 *((u64*)&dsa) = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700220
221 dsa.busNumber = busNumber;
222 dsa.subBusNumber = subBusNumber;
223 dsa.deviceId = deviceId;
224
Stephen Rothwell6b7feec2005-06-21 17:15:35 -0700225 return HvCall4(HvCallPciConfigStore32, *(u64 *)&dsa, offset, value, 0);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700226}
Stephen Rothwell45dc76a2005-06-21 17:15:33 -0700227
228static inline u64 HvCallPci_barLoad8(u16 busNumberParm, u8 subBusParm,
229 u8 deviceIdParm, u8 barNumberParm, u64 offsetParm,
230 u8 *valueParm)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700231{
232 struct HvCallPci_DsaAddr dsa;
233 struct HvCallPci_LoadReturn retVal;
234
Stephen Rothwell45dc76a2005-06-21 17:15:33 -0700235 *((u64*)&dsa) = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700236
237 dsa.busNumber = busNumberParm;
238 dsa.subBusNumber = subBusParm;
239 dsa.deviceId = deviceIdParm;
240 dsa.barNumber = barNumberParm;
241
242 HvCall3Ret16(HvCallPciBarLoad8, &retVal, *(u64 *)&dsa, offsetParm, 0);
243
Linus Torvalds1da177e2005-04-16 15:20:36 -0700244 *valueParm = retVal.value;
245
246 return retVal.rc;
247}
Stephen Rothwell45dc76a2005-06-21 17:15:33 -0700248
249static inline u64 HvCallPci_barLoad16(u16 busNumberParm, u8 subBusParm,
250 u8 deviceIdParm, u8 barNumberParm, u64 offsetParm,
251 u16 *valueParm)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700252{
253 struct HvCallPci_DsaAddr dsa;
254 struct HvCallPci_LoadReturn retVal;
255
Stephen Rothwell45dc76a2005-06-21 17:15:33 -0700256 *((u64*)&dsa) = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700257
258 dsa.busNumber = busNumberParm;
259 dsa.subBusNumber = subBusParm;
260 dsa.deviceId = deviceIdParm;
261 dsa.barNumber = barNumberParm;
262
263 HvCall3Ret16(HvCallPciBarLoad16, &retVal, *(u64 *)&dsa, offsetParm, 0);
264
Linus Torvalds1da177e2005-04-16 15:20:36 -0700265 *valueParm = retVal.value;
266
267 return retVal.rc;
268}
Stephen Rothwell45dc76a2005-06-21 17:15:33 -0700269
270static inline u64 HvCallPci_barLoad32(u16 busNumberParm, u8 subBusParm,
271 u8 deviceIdParm, u8 barNumberParm, u64 offsetParm,
272 u32 *valueParm)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700273{
274 struct HvCallPci_DsaAddr dsa;
275 struct HvCallPci_LoadReturn retVal;
276
Stephen Rothwell45dc76a2005-06-21 17:15:33 -0700277 *((u64*)&dsa) = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700278
279 dsa.busNumber = busNumberParm;
280 dsa.subBusNumber = subBusParm;
281 dsa.deviceId = deviceIdParm;
282 dsa.barNumber = barNumberParm;
283
284 HvCall3Ret16(HvCallPciBarLoad32, &retVal, *(u64 *)&dsa, offsetParm, 0);
285
Linus Torvalds1da177e2005-04-16 15:20:36 -0700286 *valueParm = retVal.value;
287
288 return retVal.rc;
289}
Stephen Rothwell45dc76a2005-06-21 17:15:33 -0700290
291static inline u64 HvCallPci_barLoad64(u16 busNumberParm, u8 subBusParm,
292 u8 deviceIdParm, u8 barNumberParm, u64 offsetParm,
293 u64 *valueParm)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700294{
295 struct HvCallPci_DsaAddr dsa;
296 struct HvCallPci_LoadReturn retVal;
297
Stephen Rothwell45dc76a2005-06-21 17:15:33 -0700298 *((u64*)&dsa) = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700299
300 dsa.busNumber = busNumberParm;
301 dsa.subBusNumber = subBusParm;
302 dsa.deviceId = deviceIdParm;
303 dsa.barNumber = barNumberParm;
304
305 HvCall3Ret16(HvCallPciBarLoad64, &retVal, *(u64 *)&dsa, offsetParm, 0);
306
Linus Torvalds1da177e2005-04-16 15:20:36 -0700307 *valueParm = retVal.value;
308
309 return retVal.rc;
310}
Stephen Rothwell45dc76a2005-06-21 17:15:33 -0700311
312static inline u64 HvCallPci_barStore8(u16 busNumberParm, u8 subBusParm,
313 u8 deviceIdParm, u8 barNumberParm, u64 offsetParm,
314 u8 valueParm)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700315{
316 struct HvCallPci_DsaAddr dsa;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700317
318 *((u64*)&dsa) = 0;
Stephen Rothwell45dc76a2005-06-21 17:15:33 -0700319
Linus Torvalds1da177e2005-04-16 15:20:36 -0700320 dsa.busNumber = busNumberParm;
321 dsa.subBusNumber = subBusParm;
322 dsa.deviceId = deviceIdParm;
323 dsa.barNumber = barNumberParm;
324
Stephen Rothwell6b7feec2005-06-21 17:15:35 -0700325 return HvCall4(HvCallPciBarStore8, *(u64 *)&dsa, offsetParm,
326 valueParm, 0);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700327}
Stephen Rothwell45dc76a2005-06-21 17:15:33 -0700328
329static inline u64 HvCallPci_barStore16(u16 busNumberParm, u8 subBusParm,
330 u8 deviceIdParm, u8 barNumberParm, u64 offsetParm,
331 u16 valueParm)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700332{
333 struct HvCallPci_DsaAddr dsa;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700334
335 *((u64*)&dsa) = 0;
Stephen Rothwell45dc76a2005-06-21 17:15:33 -0700336
Linus Torvalds1da177e2005-04-16 15:20:36 -0700337 dsa.busNumber = busNumberParm;
338 dsa.subBusNumber = subBusParm;
339 dsa.deviceId = deviceIdParm;
340 dsa.barNumber = barNumberParm;
341
Stephen Rothwell6b7feec2005-06-21 17:15:35 -0700342 return HvCall4(HvCallPciBarStore16, *(u64 *)&dsa, offsetParm,
343 valueParm, 0);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700344}
Stephen Rothwell45dc76a2005-06-21 17:15:33 -0700345
346static inline u64 HvCallPci_barStore32(u16 busNumberParm, u8 subBusParm,
347 u8 deviceIdParm, u8 barNumberParm, u64 offsetParm,
348 u32 valueParm)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700349{
350 struct HvCallPci_DsaAddr dsa;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700351
352 *((u64*)&dsa) = 0;
Stephen Rothwell45dc76a2005-06-21 17:15:33 -0700353
Linus Torvalds1da177e2005-04-16 15:20:36 -0700354 dsa.busNumber = busNumberParm;
355 dsa.subBusNumber = subBusParm;
356 dsa.deviceId = deviceIdParm;
357 dsa.barNumber = barNumberParm;
358
Stephen Rothwell6b7feec2005-06-21 17:15:35 -0700359 return HvCall4(HvCallPciBarStore32, *(u64 *)&dsa, offsetParm,
360 valueParm, 0);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700361}
Stephen Rothwell45dc76a2005-06-21 17:15:33 -0700362
363static inline u64 HvCallPci_barStore64(u16 busNumberParm, u8 subBusParm,
364 u8 deviceIdParm, u8 barNumberParm, u64 offsetParm,
365 u64 valueParm)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700366{
367 struct HvCallPci_DsaAddr dsa;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700368
369 *((u64*)&dsa) = 0;
Stephen Rothwell45dc76a2005-06-21 17:15:33 -0700370
Linus Torvalds1da177e2005-04-16 15:20:36 -0700371 dsa.busNumber = busNumberParm;
372 dsa.subBusNumber = subBusParm;
373 dsa.deviceId = deviceIdParm;
374 dsa.barNumber = barNumberParm;
375
Stephen Rothwell6b7feec2005-06-21 17:15:35 -0700376 return HvCall4(HvCallPciBarStore64, *(u64 *)&dsa, offsetParm,
377 valueParm, 0);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700378}
Stephen Rothwell45dc76a2005-06-21 17:15:33 -0700379
380static inline u64 HvCallPci_eoi(u16 busNumberParm, u8 subBusParm,
381 u8 deviceIdParm)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700382{
383 struct HvCallPci_DsaAddr dsa;
384 struct HvCallPci_LoadReturn retVal;
385
386 *((u64*)&dsa) = 0;
387
388 dsa.busNumber = busNumberParm;
389 dsa.subBusNumber = subBusParm;
390 dsa.deviceId = deviceIdParm;
391
392 HvCall1Ret16(HvCallPciEoi, &retVal, *(u64*)&dsa);
393
Linus Torvalds1da177e2005-04-16 15:20:36 -0700394 return retVal.rc;
395}
Stephen Rothwell45dc76a2005-06-21 17:15:33 -0700396
397static inline u64 HvCallPci_getBarParms(u16 busNumberParm, u8 subBusParm,
398 u8 deviceIdParm, u8 barNumberParm, u64 parms, u32 sizeofParms)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700399{
400 struct HvCallPci_DsaAddr dsa;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700401
402 *((u64*)&dsa) = 0;
403
404 dsa.busNumber = busNumberParm;
405 dsa.subBusNumber = subBusParm;
406 dsa.deviceId = deviceIdParm;
407 dsa.barNumber = barNumberParm;
408
Stephen Rothwell6b7feec2005-06-21 17:15:35 -0700409 return HvCall3(HvCallPciGetBarParms, *(u64*)&dsa, parms, sizeofParms);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700410}
Stephen Rothwell45dc76a2005-06-21 17:15:33 -0700411
412static inline u64 HvCallPci_maskFisr(u16 busNumberParm, u8 subBusParm,
413 u8 deviceIdParm, u64 fisrMask)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700414{
415 struct HvCallPci_DsaAddr dsa;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700416
Stephen Rothwell45dc76a2005-06-21 17:15:33 -0700417 *((u64*)&dsa) = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700418
419 dsa.busNumber = busNumberParm;
420 dsa.subBusNumber = subBusParm;
421 dsa.deviceId = deviceIdParm;
422
Stephen Rothwell6b7feec2005-06-21 17:15:35 -0700423 return HvCall2(HvCallPciMaskFisr, *(u64*)&dsa, fisrMask);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700424}
Stephen Rothwell45dc76a2005-06-21 17:15:33 -0700425
426static inline u64 HvCallPci_unmaskFisr(u16 busNumberParm, u8 subBusParm,
427 u8 deviceIdParm, u64 fisrMask)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700428{
429 struct HvCallPci_DsaAddr dsa;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700430
Stephen Rothwell45dc76a2005-06-21 17:15:33 -0700431 *((u64*)&dsa) = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700432
433 dsa.busNumber = busNumberParm;
434 dsa.subBusNumber = subBusParm;
435 dsa.deviceId = deviceIdParm;
436
Stephen Rothwell6b7feec2005-06-21 17:15:35 -0700437 return HvCall2(HvCallPciUnmaskFisr, *(u64*)&dsa, fisrMask);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700438}
Stephen Rothwell45dc76a2005-06-21 17:15:33 -0700439
440static inline u64 HvCallPci_setSlotReset(u16 busNumberParm, u8 subBusParm,
441 u8 deviceIdParm, u64 onNotOff)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700442{
443 struct HvCallPci_DsaAddr dsa;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700444
445 *((u64*)&dsa) = 0;
446
447 dsa.busNumber = busNumberParm;
448 dsa.subBusNumber = subBusParm;
449 dsa.deviceId = deviceIdParm;
450
Stephen Rothwell6b7feec2005-06-21 17:15:35 -0700451 return HvCall2(HvCallPciSetSlotReset, *(u64*)&dsa, onNotOff);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700452}
Stephen Rothwell45dc76a2005-06-21 17:15:33 -0700453
454static inline u64 HvCallPci_getDeviceInfo(u16 busNumberParm, u8 subBusParm,
455 u8 deviceNumberParm, u64 parms, u32 sizeofParms)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700456{
457 struct HvCallPci_DsaAddr dsa;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700458
459 *((u64*)&dsa) = 0;
460
461 dsa.busNumber = busNumberParm;
462 dsa.subBusNumber = subBusParm;
463 dsa.deviceId = deviceNumberParm << 4;
464
Stephen Rothwell6b7feec2005-06-21 17:15:35 -0700465 return HvCall3(HvCallPciGetDeviceInfo, *(u64*)&dsa, parms, sizeofParms);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700466}
Stephen Rothwell45dc76a2005-06-21 17:15:33 -0700467
468static inline u64 HvCallPci_maskInterrupts(u16 busNumberParm, u8 subBusParm,
469 u8 deviceIdParm, u64 interruptMask)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700470{
471 struct HvCallPci_DsaAddr dsa;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700472
Stephen Rothwell45dc76a2005-06-21 17:15:33 -0700473 *((u64*)&dsa) = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700474
475 dsa.busNumber = busNumberParm;
476 dsa.subBusNumber = subBusParm;
477 dsa.deviceId = deviceIdParm;
478
Stephen Rothwell6b7feec2005-06-21 17:15:35 -0700479 return HvCall2(HvCallPciMaskInterrupts, *(u64*)&dsa, interruptMask);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700480}
Stephen Rothwell45dc76a2005-06-21 17:15:33 -0700481
482static inline u64 HvCallPci_unmaskInterrupts(u16 busNumberParm, u8 subBusParm,
483 u8 deviceIdParm, u64 interruptMask)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700484{
485 struct HvCallPci_DsaAddr dsa;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700486
Stephen Rothwell45dc76a2005-06-21 17:15:33 -0700487 *((u64*)&dsa) = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700488
489 dsa.busNumber = busNumberParm;
490 dsa.subBusNumber = subBusParm;
491 dsa.deviceId = deviceIdParm;
492
Stephen Rothwell6b7feec2005-06-21 17:15:35 -0700493 return HvCall2(HvCallPciUnmaskInterrupts, *(u64*)&dsa, interruptMask);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700494}
Linus Torvalds1da177e2005-04-16 15:20:36 -0700495
Stephen Rothwell45dc76a2005-06-21 17:15:33 -0700496static inline u64 HvCallPci_getBusUnitInfo(u16 busNumberParm, u8 subBusParm,
497 u8 deviceIdParm, u64 parms, u32 sizeofParms)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700498{
499 struct HvCallPci_DsaAddr dsa;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700500
Stephen Rothwell45dc76a2005-06-21 17:15:33 -0700501 *((u64*)&dsa) = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700502
503 dsa.busNumber = busNumberParm;
504 dsa.subBusNumber = subBusParm;
505 dsa.deviceId = deviceIdParm;
506
Stephen Rothwell6b7feec2005-06-21 17:15:35 -0700507 return HvCall3(HvCallPciGetBusUnitInfo, *(u64*)&dsa, parms,
508 sizeofParms);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700509}
Linus Torvalds1da177e2005-04-16 15:20:36 -0700510
Stephen Rothwell45dc76a2005-06-21 17:15:33 -0700511static inline int HvCallPci_getBusVpd(u16 busNumParm, u64 destParm,
512 u16 sizeParm)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700513{
Stephen Rothwell6b7feec2005-06-21 17:15:35 -0700514 u64 xRc = HvCall4(HvCallPciGetCardVpd, busNumParm, destParm,
515 sizeParm, HvCallPci_BusVpd);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700516 if (xRc == -1)
Stephen Rothwell6b7feec2005-06-21 17:15:35 -0700517 return -1;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700518 else
Stephen Rothwell6b7feec2005-06-21 17:15:35 -0700519 return xRc & 0xFFFF;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700520}
Linus Torvalds1da177e2005-04-16 15:20:36 -0700521
Stephen Rothwell45dc76a2005-06-21 17:15:33 -0700522static inline int HvCallPci_getBusAdapterVpd(u16 busNumParm, u64 destParm,
523 u16 sizeParm)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700524{
Stephen Rothwell6b7feec2005-06-21 17:15:35 -0700525 u64 xRc = HvCall4(HvCallPciGetCardVpd, busNumParm, destParm,
526 sizeParm, HvCallPci_BusAdapterVpd);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700527 if (xRc == -1)
Stephen Rothwell6b7feec2005-06-21 17:15:35 -0700528 return -1;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700529 else
Stephen Rothwell6b7feec2005-06-21 17:15:35 -0700530 return xRc & 0xFFFF;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700531}
Stephen Rothwell45dc76a2005-06-21 17:15:33 -0700532
Linus Torvalds1da177e2005-04-16 15:20:36 -0700533#endif /* _HVCALLPCI_H */