aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/powerpc/platforms/iseries/iommu.c2
-rw-r--r--arch/powerpc/platforms/iseries/pci.c20
-rw-r--r--arch/powerpc/platforms/iseries/pci.h13
-rw-r--r--arch/powerpc/platforms/iseries/vpdinfo.c4
-rw-r--r--include/asm-ppc64/iSeries/HvCallPci.h243
-rw-r--r--include/asm-ppc64/pci-bridge.h3
6 files changed, 23 insertions, 262 deletions
diff --git a/arch/powerpc/platforms/iseries/iommu.c b/arch/powerpc/platforms/iseries/iommu.c
index 533d9b467402..1db26d8be640 100644
--- a/arch/powerpc/platforms/iseries/iommu.c
+++ b/arch/powerpc/platforms/iseries/iommu.c
@@ -124,7 +124,7 @@ static void iommu_table_getparms(struct pci_dn *pdn,
124 124
125 memset(parms, 0, sizeof(*parms)); 125 memset(parms, 0, sizeof(*parms));
126 126
127 parms->itc_busno = pdn->DsaAddr.Dsa.busNumber; 127 parms->itc_busno = pdn->busno;
128 parms->itc_slotno = pdn->LogicalSlot; 128 parms->itc_slotno = pdn->LogicalSlot;
129 parms->itc_virtbus = 0; 129 parms->itc_virtbus = 0;
130 130
diff --git a/arch/powerpc/platforms/iseries/pci.c b/arch/powerpc/platforms/iseries/pci.c
index fe34d1175818..d14e9d9d7797 100644
--- a/arch/powerpc/platforms/iseries/pci.c
+++ b/arch/powerpc/platforms/iseries/pci.c
@@ -223,13 +223,8 @@ static struct device_node *build_device_node(HvBusNumber Bus,
223 node->data = pdn; 223 node->data = pdn;
224 pdn->node = node; 224 pdn->node = node;
225 list_add_tail(&pdn->Device_List, &iSeries_Global_Device_List); 225 list_add_tail(&pdn->Device_List, &iSeries_Global_Device_List);
226#if 0 226 pdn->busno = Bus;
227 pdn->DsaAddr = ((u64)Bus << 48) + ((u64)SubBus << 40) + ((u64)0x10 << 32); 227 pdn->bussubno = SubBus;
228#endif
229 pdn->DsaAddr.DsaAddr = 0;
230 pdn->DsaAddr.Dsa.busNumber = Bus;
231 pdn->DsaAddr.Dsa.subBusNumber = SubBus;
232 pdn->DsaAddr.Dsa.deviceId = 0x10;
233 pdn->devfn = PCI_DEVFN(ISERIES_ENCODE_DEVICE(AgentId), Function); 228 pdn->devfn = PCI_DEVFN(ISERIES_ENCODE_DEVICE(AgentId), Function);
234 return node; 229 return node;
235} 230}
@@ -554,8 +549,7 @@ static struct device_node *find_Device_Node(int bus, int devfn)
554 struct pci_dn *pdn; 549 struct pci_dn *pdn;
555 550
556 list_for_each_entry(pdn, &iSeries_Global_Device_List, Device_List) { 551 list_for_each_entry(pdn, &iSeries_Global_Device_List, Device_List) {
557 if ((bus == pdn->DsaAddr.Dsa.busNumber) && 552 if ((bus == pdn->busno) && (devfn == pdn->devfn))
558 (devfn == pdn->devfn))
559 return pdn->node; 553 return pdn->node;
560 } 554 }
561 return NULL; 555 return NULL;
@@ -612,7 +606,7 @@ static int iSeries_pci_read_config(struct pci_bus *bus, unsigned int devfn,
612 } 606 }
613 607
614 fn = hv_cfg_read_func[(size - 1) & 3]; 608 fn = hv_cfg_read_func[(size - 1) & 3];
615 HvCall3Ret16(fn, &ret, PCI_DN(node)->DsaAddr.DsaAddr, offset, 0); 609 HvCall3Ret16(fn, &ret, iseries_ds_addr(node), offset, 0);
616 610
617 if (ret.rc != 0) { 611 if (ret.rc != 0) {
618 *val = ~0; 612 *val = ~0;
@@ -640,7 +634,7 @@ static int iSeries_pci_write_config(struct pci_bus *bus, unsigned int devfn,
640 return PCIBIOS_BAD_REGISTER_NUMBER; 634 return PCIBIOS_BAD_REGISTER_NUMBER;
641 635
642 fn = hv_cfg_write_func[(size - 1) & 3]; 636 fn = hv_cfg_write_func[(size - 1) & 3];
643 ret = HvCall4(fn, PCI_DN(node)->DsaAddr.DsaAddr, offset, val, 0); 637 ret = HvCall4(fn, iseries_ds_addr(node), offset, val, 0);
644 638
645 if (ret != 0) 639 if (ret != 0)
646 return PCIBIOS_DEVICE_NOT_FOUND; 640 return PCIBIOS_DEVICE_NOT_FOUND;
@@ -671,7 +665,7 @@ static int CheckReturnCode(char *TextHdr, struct device_node *DevNode,
671 ++Pci_Error_Count; 665 ++Pci_Error_Count;
672 (*retry)++; 666 (*retry)++;
673 printk("PCI: %s: Device 0x%04X:%02X I/O Error(%2d): 0x%04X\n", 667 printk("PCI: %s: Device 0x%04X:%02X I/O Error(%2d): 0x%04X\n",
674 TextHdr, pdn->DsaAddr.Dsa.busNumber, pdn->devfn, 668 TextHdr, pdn->busno, pdn->devfn,
675 *retry, (int)ret); 669 *retry, (int)ret);
676 /* 670 /*
677 * Bump the retry and check for retry count exceeded. 671 * Bump the retry and check for retry count exceeded.
@@ -712,7 +706,7 @@ static inline struct device_node *xlate_iomm_address(
712 706
713 if (DevNode != NULL) { 707 if (DevNode != NULL) {
714 int barnum = iobar_table[TableIndex]; 708 int barnum = iobar_table[TableIndex];
715 *dsaptr = PCI_DN(DevNode)->DsaAddr.DsaAddr | (barnum << 24); 709 *dsaptr = iseries_ds_addr(DevNode) | (barnum << 24);
716 *BarOffsetPtr = BaseIoAddr % IOMM_TABLE_ENTRY_SIZE; 710 *BarOffsetPtr = BaseIoAddr % IOMM_TABLE_ENTRY_SIZE;
717 } else 711 } else
718 panic("PCI: Invalid PCI IoAddress detected!\n"); 712 panic("PCI: Invalid PCI IoAddress detected!\n");
diff --git a/arch/powerpc/platforms/iseries/pci.h b/arch/powerpc/platforms/iseries/pci.h
index 94b4bfdceadf..33a8489fde54 100644
--- a/arch/powerpc/platforms/iseries/pci.h
+++ b/arch/powerpc/platforms/iseries/pci.h
@@ -30,6 +30,8 @@
30 * End Change Activity 30 * End Change Activity
31 */ 31 */
32 32
33#include <asm/pci-bridge.h>
34
33struct pci_dev; /* For Forward Reference */ 35struct pci_dev; /* For Forward Reference */
34 36
35/* 37/*
@@ -45,6 +47,17 @@ struct pci_dev; /* For Forward Reference */
45#define ISERIES_GET_DEVICE_FROM_SUBBUS(subbus) ((subbus >> 5) & 0x7) 47#define ISERIES_GET_DEVICE_FROM_SUBBUS(subbus) ((subbus >> 5) & 0x7)
46#define ISERIES_GET_FUNCTION_FROM_SUBBUS(subbus) ((subbus >> 2) & 0x7) 48#define ISERIES_GET_FUNCTION_FROM_SUBBUS(subbus) ((subbus >> 2) & 0x7)
47 49
50/*
51 * Generate a Direct Select Address for the Hypervisor
52 */
53static inline u64 iseries_ds_addr(struct device_node *node)
54{
55 struct pci_dn *pdn = PCI_DN(node);
56
57 return ((u64)pdn->busno << 48) + ((u64)pdn->bussubno << 40)
58 + ((u64)0x10 << 32);
59}
60
48extern void iSeries_Device_Information(struct pci_dev*, int); 61extern void iSeries_Device_Information(struct pci_dev*, int);
49 62
50#endif /* _PLATFORMS_ISERIES_PCI_H */ 63#endif /* _PLATFORMS_ISERIES_PCI_H */
diff --git a/arch/powerpc/platforms/iseries/vpdinfo.c b/arch/powerpc/platforms/iseries/vpdinfo.c
index dcdac995565c..a03984e19c13 100644
--- a/arch/powerpc/platforms/iseries/vpdinfo.c
+++ b/arch/powerpc/platforms/iseries/vpdinfo.c
@@ -258,8 +258,8 @@ void __init iSeries_Device_Information(struct pci_dev *PciDev, int count)
258 } 258 }
259 259
260 pdn = PCI_DN(DevNode); 260 pdn = PCI_DN(DevNode);
261 bus = pdn->DsaAddr.Dsa.busNumber; 261 bus = pdn->busno;
262 subbus = pdn->DsaAddr.Dsa.subBusNumber; 262 subbus = pdn->bussubno;
263 agent = ISERIES_PCI_AGENTID(ISERIES_GET_DEVICE_FROM_SUBBUS(subbus), 263 agent = ISERIES_PCI_AGENTID(ISERIES_GET_DEVICE_FROM_SUBBUS(subbus),
264 ISERIES_GET_FUNCTION_FROM_SUBBUS(subbus)); 264 ISERIES_GET_FUNCTION_FROM_SUBBUS(subbus));
265 iSeries_Get_Location_Code(bus, agent, &frame, card); 265 iSeries_Get_Location_Code(bus, agent, &frame, card);
diff --git a/include/asm-ppc64/iSeries/HvCallPci.h b/include/asm-ppc64/iSeries/HvCallPci.h
index c8d675c40f5e..17b4840b64b2 100644
--- a/include/asm-ppc64/iSeries/HvCallPci.h
+++ b/include/asm-ppc64/iSeries/HvCallPci.h
@@ -126,25 +126,6 @@ enum HvCallPci_VpdType {
126#define HvCallPciUnmaskInterrupts HvCallPci + 49 126#define HvCallPciUnmaskInterrupts HvCallPci + 49
127#define HvCallPciGetBusUnitInfo HvCallPci + 50 127#define HvCallPciGetBusUnitInfo HvCallPci + 50
128 128
129static inline u64 HvCallPci_configLoad8(u16 busNumber, u8 subBusNumber,
130 u8 deviceId, u32 offset, u8 *value)
131{
132 struct HvCallPci_DsaAddr dsa;
133 struct HvCallPci_LoadReturn retVal;
134
135 *((u64*)&dsa) = 0;
136
137 dsa.busNumber = busNumber;
138 dsa.subBusNumber = subBusNumber;
139 dsa.deviceId = deviceId;
140
141 HvCall3Ret16(HvCallPciConfigLoad8, &retVal, *(u64 *)&dsa, offset, 0);
142
143 *value = retVal.value;
144
145 return retVal.rc;
146}
147
148static inline u64 HvCallPci_configLoad16(u16 busNumber, u8 subBusNumber, 129static inline u64 HvCallPci_configLoad16(u16 busNumber, u8 subBusNumber,
149 u8 deviceId, u32 offset, u16 *value) 130 u8 deviceId, u32 offset, u16 *value)
150{ 131{
@@ -164,25 +145,6 @@ static inline u64 HvCallPci_configLoad16(u16 busNumber, u8 subBusNumber,
164 return retVal.rc; 145 return retVal.rc;
165} 146}
166 147
167static inline u64 HvCallPci_configLoad32(u16 busNumber, u8 subBusNumber,
168 u8 deviceId, u32 offset, u32 *value)
169{
170 struct HvCallPci_DsaAddr dsa;
171 struct HvCallPci_LoadReturn retVal;
172
173 *((u64*)&dsa) = 0;
174
175 dsa.busNumber = busNumber;
176 dsa.subBusNumber = subBusNumber;
177 dsa.deviceId = deviceId;
178
179 HvCall3Ret16(HvCallPciConfigLoad32, &retVal, *(u64 *)&dsa, offset, 0);
180
181 *value = retVal.value;
182
183 return retVal.rc;
184}
185
186static inline u64 HvCallPci_configStore8(u16 busNumber, u8 subBusNumber, 148static inline u64 HvCallPci_configStore8(u16 busNumber, u8 subBusNumber,
187 u8 deviceId, u32 offset, u8 value) 149 u8 deviceId, u32 offset, u8 value)
188{ 150{
@@ -197,186 +159,6 @@ static inline u64 HvCallPci_configStore8(u16 busNumber, u8 subBusNumber,
197 return HvCall4(HvCallPciConfigStore8, *(u64 *)&dsa, offset, value, 0); 159 return HvCall4(HvCallPciConfigStore8, *(u64 *)&dsa, offset, value, 0);
198} 160}
199 161
200static inline u64 HvCallPci_configStore16(u16 busNumber, u8 subBusNumber,
201 u8 deviceId, u32 offset, u16 value)
202{
203 struct HvCallPci_DsaAddr dsa;
204
205 *((u64*)&dsa) = 0;
206
207 dsa.busNumber = busNumber;
208 dsa.subBusNumber = subBusNumber;
209 dsa.deviceId = deviceId;
210
211 return HvCall4(HvCallPciConfigStore16, *(u64 *)&dsa, offset, value, 0);
212}
213
214static inline u64 HvCallPci_configStore32(u16 busNumber, u8 subBusNumber,
215 u8 deviceId, u32 offset, u32 value)
216{
217 struct HvCallPci_DsaAddr dsa;
218
219 *((u64*)&dsa) = 0;
220
221 dsa.busNumber = busNumber;
222 dsa.subBusNumber = subBusNumber;
223 dsa.deviceId = deviceId;
224
225 return HvCall4(HvCallPciConfigStore32, *(u64 *)&dsa, offset, value, 0);
226}
227
228static inline u64 HvCallPci_barLoad8(u16 busNumberParm, u8 subBusParm,
229 u8 deviceIdParm, u8 barNumberParm, u64 offsetParm,
230 u8 *valueParm)
231{
232 struct HvCallPci_DsaAddr dsa;
233 struct HvCallPci_LoadReturn retVal;
234
235 *((u64*)&dsa) = 0;
236
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
244 *valueParm = retVal.value;
245
246 return retVal.rc;
247}
248
249static inline u64 HvCallPci_barLoad16(u16 busNumberParm, u8 subBusParm,
250 u8 deviceIdParm, u8 barNumberParm, u64 offsetParm,
251 u16 *valueParm)
252{
253 struct HvCallPci_DsaAddr dsa;
254 struct HvCallPci_LoadReturn retVal;
255
256 *((u64*)&dsa) = 0;
257
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
265 *valueParm = retVal.value;
266
267 return retVal.rc;
268}
269
270static inline u64 HvCallPci_barLoad32(u16 busNumberParm, u8 subBusParm,
271 u8 deviceIdParm, u8 barNumberParm, u64 offsetParm,
272 u32 *valueParm)
273{
274 struct HvCallPci_DsaAddr dsa;
275 struct HvCallPci_LoadReturn retVal;
276
277 *((u64*)&dsa) = 0;
278
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
286 *valueParm = retVal.value;
287
288 return retVal.rc;
289}
290
291static inline u64 HvCallPci_barLoad64(u16 busNumberParm, u8 subBusParm,
292 u8 deviceIdParm, u8 barNumberParm, u64 offsetParm,
293 u64 *valueParm)
294{
295 struct HvCallPci_DsaAddr dsa;
296 struct HvCallPci_LoadReturn retVal;
297
298 *((u64*)&dsa) = 0;
299
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
307 *valueParm = retVal.value;
308
309 return retVal.rc;
310}
311
312static inline u64 HvCallPci_barStore8(u16 busNumberParm, u8 subBusParm,
313 u8 deviceIdParm, u8 barNumberParm, u64 offsetParm,
314 u8 valueParm)
315{
316 struct HvCallPci_DsaAddr dsa;
317
318 *((u64*)&dsa) = 0;
319
320 dsa.busNumber = busNumberParm;
321 dsa.subBusNumber = subBusParm;
322 dsa.deviceId = deviceIdParm;
323 dsa.barNumber = barNumberParm;
324
325 return HvCall4(HvCallPciBarStore8, *(u64 *)&dsa, offsetParm,
326 valueParm, 0);
327}
328
329static inline u64 HvCallPci_barStore16(u16 busNumberParm, u8 subBusParm,
330 u8 deviceIdParm, u8 barNumberParm, u64 offsetParm,
331 u16 valueParm)
332{
333 struct HvCallPci_DsaAddr dsa;
334
335 *((u64*)&dsa) = 0;
336
337 dsa.busNumber = busNumberParm;
338 dsa.subBusNumber = subBusParm;
339 dsa.deviceId = deviceIdParm;
340 dsa.barNumber = barNumberParm;
341
342 return HvCall4(HvCallPciBarStore16, *(u64 *)&dsa, offsetParm,
343 valueParm, 0);
344}
345
346static inline u64 HvCallPci_barStore32(u16 busNumberParm, u8 subBusParm,
347 u8 deviceIdParm, u8 barNumberParm, u64 offsetParm,
348 u32 valueParm)
349{
350 struct HvCallPci_DsaAddr dsa;
351
352 *((u64*)&dsa) = 0;
353
354 dsa.busNumber = busNumberParm;
355 dsa.subBusNumber = subBusParm;
356 dsa.deviceId = deviceIdParm;
357 dsa.barNumber = barNumberParm;
358
359 return HvCall4(HvCallPciBarStore32, *(u64 *)&dsa, offsetParm,
360 valueParm, 0);
361}
362
363static inline u64 HvCallPci_barStore64(u16 busNumberParm, u8 subBusParm,
364 u8 deviceIdParm, u8 barNumberParm, u64 offsetParm,
365 u64 valueParm)
366{
367 struct HvCallPci_DsaAddr dsa;
368
369 *((u64*)&dsa) = 0;
370
371 dsa.busNumber = busNumberParm;
372 dsa.subBusNumber = subBusParm;
373 dsa.deviceId = deviceIdParm;
374 dsa.barNumber = barNumberParm;
375
376 return HvCall4(HvCallPciBarStore64, *(u64 *)&dsa, offsetParm,
377 valueParm, 0);
378}
379
380static inline u64 HvCallPci_eoi(u16 busNumberParm, u8 subBusParm, 162static inline u64 HvCallPci_eoi(u16 busNumberParm, u8 subBusParm,
381 u8 deviceIdParm) 163 u8 deviceIdParm)
382{ 164{
@@ -437,20 +219,6 @@ static inline u64 HvCallPci_unmaskFisr(u16 busNumberParm, u8 subBusParm,
437 return HvCall2(HvCallPciUnmaskFisr, *(u64*)&dsa, fisrMask); 219 return HvCall2(HvCallPciUnmaskFisr, *(u64*)&dsa, fisrMask);
438} 220}
439 221
440static inline u64 HvCallPci_setSlotReset(u16 busNumberParm, u8 subBusParm,
441 u8 deviceIdParm, u64 onNotOff)
442{
443 struct HvCallPci_DsaAddr dsa;
444
445 *((u64*)&dsa) = 0;
446
447 dsa.busNumber = busNumberParm;
448 dsa.subBusNumber = subBusParm;
449 dsa.deviceId = deviceIdParm;
450
451 return HvCall2(HvCallPciSetSlotReset, *(u64*)&dsa, onNotOff);
452}
453
454static inline u64 HvCallPci_getDeviceInfo(u16 busNumberParm, u8 subBusParm, 222static inline u64 HvCallPci_getDeviceInfo(u16 busNumberParm, u8 subBusParm,
455 u8 deviceNumberParm, u64 parms, u32 sizeofParms) 223 u8 deviceNumberParm, u64 parms, u32 sizeofParms)
456{ 224{
@@ -519,15 +287,4 @@ static inline int HvCallPci_getBusVpd(u16 busNumParm, u64 destParm,
519 return xRc & 0xFFFF; 287 return xRc & 0xFFFF;
520} 288}
521 289
522static inline int HvCallPci_getBusAdapterVpd(u16 busNumParm, u64 destParm,
523 u16 sizeParm)
524{
525 u64 xRc = HvCall4(HvCallPciGetCardVpd, busNumParm, destParm,
526 sizeParm, HvCallPci_BusAdapterVpd);
527 if (xRc == -1)
528 return -1;
529 else
530 return xRc & 0xFFFF;
531}
532
533#endif /* _HVCALLPCI_H */ 290#endif /* _HVCALLPCI_H */
diff --git a/include/asm-ppc64/pci-bridge.h b/include/asm-ppc64/pci-bridge.h
index 01bffca61f89..0474bdbf556c 100644
--- a/include/asm-ppc64/pci-bridge.h
+++ b/include/asm-ppc64/pci-bridge.h
@@ -77,9 +77,6 @@ struct pci_dn {
77 struct device_node *node; /* back-pointer to the device_node */ 77 struct device_node *node; /* back-pointer to the device_node */
78#ifdef CONFIG_PPC_ISERIES 78#ifdef CONFIG_PPC_ISERIES
79 struct list_head Device_List; 79 struct list_head Device_List;
80 union HvDsaMap DsaAddr; /* Direct Select Address */
81 /* busNumber, subBusNumber, */
82 /* deviceId, barNumber */
83 int Irq; /* Assigned IRQ */ 80 int Irq; /* Assigned IRQ */
84 int Flags; /* Possible flags(disable/bist)*/ 81 int Flags; /* Possible flags(disable/bist)*/
85 u8 LogicalSlot; /* Hv Slot Index for Tces */ 82 u8 LogicalSlot; /* Hv Slot Index for Tces */