psycho_common.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #ifndef _PSYCHO_COMMON_H
  2. #define _PSYCHO_COMMON_H
  3. /* U2P Programmer's Manual, page 13-55, configuration space
  4. * address format:
  5. *
  6. * 32 24 23 16 15 11 10 8 7 2 1 0
  7. * ---------------------------------------------------------
  8. * |0 0 0 0 0 0 0 0 1| bus | device | function | reg | 0 0 |
  9. * ---------------------------------------------------------
  10. */
  11. #define PSYCHO_CONFIG_BASE(PBM) \
  12. ((PBM)->config_space | (1UL << 24))
  13. #define PSYCHO_CONFIG_ENCODE(BUS, DEVFN, REG) \
  14. (((unsigned long)(BUS) << 16) | \
  15. ((unsigned long)(DEVFN) << 8) | \
  16. ((unsigned long)(REG)))
  17. static inline void *psycho_pci_config_mkaddr(struct pci_pbm_info *pbm,
  18. unsigned char bus,
  19. unsigned int devfn,
  20. int where)
  21. {
  22. return (void *)
  23. (PSYCHO_CONFIG_BASE(pbm) |
  24. PSYCHO_CONFIG_ENCODE(bus, devfn, where));
  25. }
  26. enum psycho_error_type {
  27. UE_ERR, CE_ERR, PCI_ERR
  28. };
  29. extern void psycho_check_iommu_error(struct pci_pbm_info *pbm,
  30. unsigned long afsr,
  31. unsigned long afar,
  32. enum psycho_error_type type);
  33. extern irqreturn_t psycho_pcierr_intr(int irq, void *dev_id);
  34. extern int psycho_iommu_init(struct pci_pbm_info *pbm, int tsbsize,
  35. u32 dvma_offset, u32 dma_mask,
  36. unsigned long write_complete_offset);
  37. extern void psycho_pbm_init_common(struct pci_pbm_info *pbm,
  38. struct platform_device *op,
  39. const char *chip_name, int chip_type);
  40. #endif /* _PSYCHO_COMMON_H */