diff options
author | Mark Maule <maule@sgi.com> | 2005-09-23 13:31:53 -0400 |
---|---|---|
committer | Tony Luck <tony.luck@intel.com> | 2005-09-23 14:21:59 -0400 |
commit | 61b9cf7c6cf5077c40ad37480fa56f6574af3db5 (patch) | |
tree | dd2f5c7a770005d13910ed581128542720ee8936 | |
parent | 12f44f46bc9c6dc79255e661b085797af395d8da (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>
-rw-r--r-- | arch/ia64/sn/pci/pci_dma.c | 46 | ||||
-rw-r--r-- | include/asm-ia64/sn/sn_sal.h | 2 |
2 files changed, 47 insertions, 1 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; |
diff --git a/include/asm-ia64/sn/sn_sal.h b/include/asm-ia64/sn/sn_sal.h index fea35b33d4e4..b2d32837723f 100644 --- a/include/asm-ia64/sn/sn_sal.h +++ b/include/asm-ia64/sn/sn_sal.h | |||
@@ -67,7 +67,7 @@ | |||
67 | #define SN_SAL_IOIF_INTERRUPT 0x0200004a | 67 | #define SN_SAL_IOIF_INTERRUPT 0x0200004a |
68 | #define SN_SAL_HWPERF_OP 0x02000050 // lock | 68 | #define SN_SAL_HWPERF_OP 0x02000050 // lock |
69 | #define SN_SAL_IOIF_ERROR_INTERRUPT 0x02000051 | 69 | #define SN_SAL_IOIF_ERROR_INTERRUPT 0x02000051 |
70 | 70 | #define SN_SAL_IOIF_PCI_SAFE 0x02000052 | |
71 | #define SN_SAL_IOIF_SLOT_ENABLE 0x02000053 | 71 | #define SN_SAL_IOIF_SLOT_ENABLE 0x02000053 |
72 | #define SN_SAL_IOIF_SLOT_DISABLE 0x02000054 | 72 | #define SN_SAL_IOIF_SLOT_DISABLE 0x02000054 |
73 | #define SN_SAL_IOIF_GET_HUBDEV_INFO 0x02000055 | 73 | #define SN_SAL_IOIF_GET_HUBDEV_INFO 0x02000055 |