aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ia64/sn
diff options
context:
space:
mode:
authorMark Maule <maule@sgi.com>2005-09-23 13:31:53 -0400
committerTony Luck <tony.luck@intel.com>2005-09-23 14:21:59 -0400
commit61b9cf7c6cf5077c40ad37480fa56f6574af3db5 (patch)
treedd2f5c7a770005d13910ed581128542720ee8936 /arch/ia64/sn
parent12f44f46bc9c6dc79255e661b085797af395d8da (diff)
[IA64-SGI] fix sn_pci_legacy_read/fix sn_pci_legacy_write
This patch adds a #define for SN_SAL_IOIF_PCI_SAFE and makes that the preferred method of implementing sn_pci_legacy_read() and sn_pci_legacy_write(). This SAL call has been present in SGI proms since version 4.10. If the SN_SAL_IOIF_PCI_SAFE call fails, revert to the previous code for compatability with older proms. Signed-off-by: Mark Maule <maule@sgi.com> Signed-off-by: Tony Luck <tony.luck@intel.com>
Diffstat (limited to 'arch/ia64/sn')
-rw-r--r--arch/ia64/sn/pci/pci_dma.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/arch/ia64/sn/pci/pci_dma.c b/arch/ia64/sn/pci/pci_dma.c
index 0e4b9ad9ef02..abdf6eea6ac8 100644
--- a/arch/ia64/sn/pci/pci_dma.c
+++ b/arch/ia64/sn/pci/pci_dma.c
@@ -326,6 +326,29 @@ int sn_pci_legacy_read(struct pci_bus *bus, u16 port, u32 *val, u8 size)
326{ 326{
327 unsigned long addr; 327 unsigned long addr;
328 int ret; 328 int ret;
329 struct ia64_sal_retval isrv;
330
331 /*
332 * First, try the SN_SAL_IOIF_PCI_SAFE SAL call which can work
333 * around hw issues at the pci bus level. SGI proms older than
334 * 4.10 don't implment this.
335 */
336
337 SAL_CALL(isrv, SN_SAL_IOIF_PCI_SAFE,
338 pci_domain_nr(bus), bus->number,
339 0, /* io */
340 0, /* read */
341 port, size, __pa(val));
342
343 if (isrv.status == 0)
344 return size;
345
346 /*
347 * If the above failed, retry using the SAL_PROBE call which should
348 * be present in all proms (but which cannot work round PCI chipset
349 * bugs). This code is retained for compatability with old
350 * pre-4.10 proms, and should be removed at some point in the future.
351 */
329 352
330 if (!SN_PCIBUS_BUSSOFT(bus)) 353 if (!SN_PCIBUS_BUSSOFT(bus))
331 return -ENODEV; 354 return -ENODEV;
@@ -349,6 +372,29 @@ int sn_pci_legacy_write(struct pci_bus *bus, u16 port, u32 val, u8 size)
349 int ret = size; 372 int ret = size;
350 unsigned long paddr; 373 unsigned long paddr;
351 unsigned long *addr; 374 unsigned long *addr;
375 struct ia64_sal_retval isrv;
376
377 /*
378 * First, try the SN_SAL_IOIF_PCI_SAFE SAL call which can work
379 * around hw issues at the pci bus level. SGI proms older than
380 * 4.10 don't implment this.
381 */
382
383 SAL_CALL(isrv, SN_SAL_IOIF_PCI_SAFE,
384 pci_domain_nr(bus), bus->number,
385 0, /* io */
386 1, /* write */
387 port, size, __pa(&val));
388
389 if (isrv.status == 0)
390 return size;
391
392 /*
393 * If the above failed, retry using the SAL_PROBE call which should
394 * be present in all proms (but which cannot work round PCI chipset
395 * bugs). This code is retained for compatability with old
396 * pre-4.10 proms, and should be removed at some point in the future.
397 */
352 398
353 if (!SN_PCIBUS_BUSSOFT(bus)) { 399 if (!SN_PCIBUS_BUSSOFT(bus)) {
354 ret = -ENODEV; 400 ret = -ENODEV;