psycho_common.h 1.4 KB

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