David S. Miller | a21cff3 | 2008-09-10 03:07:03 -0700 | [diff] [blame] | 1 | #ifndef _PSYCHO_COMMON_H |
| 2 | #define _PSYCHO_COMMON_H |
| 3 | |
David S. Miller | 2e57572 | 2008-09-16 14:11:43 -0700 | [diff] [blame] | 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 | |
| 19 | static inline void *psycho_pci_config_mkaddr(struct pci_pbm_info *pbm, |
| 20 | unsigned char bus, |
| 21 | unsigned int devfn, |
| 22 | int where) |
| 23 | { |
| 24 | return (void *) |
| 25 | (PSYCHO_CONFIG_BASE(pbm) | |
| 26 | PSYCHO_CONFIG_ENCODE(bus, devfn, where)); |
| 27 | } |
| 28 | |
David S. Miller | e6e0037 | 2008-09-10 03:52:51 -0700 | [diff] [blame] | 29 | enum psycho_error_type { |
| 30 | UE_ERR, CE_ERR, PCI_ERR |
| 31 | }; |
| 32 | |
| 33 | extern void psycho_check_iommu_error(struct pci_pbm_info *pbm, |
| 34 | unsigned long afsr, |
| 35 | unsigned long afar, |
| 36 | enum psycho_error_type type); |
| 37 | |
| 38 | extern irqreturn_t psycho_pcierr_intr(int irq, void *dev_id); |
| 39 | |
David S. Miller | a21cff3 | 2008-09-10 03:07:03 -0700 | [diff] [blame] | 40 | extern int psycho_iommu_init(struct pci_pbm_info *pbm, int tsbsize, |
| 41 | u32 dvma_offset, u32 dma_mask, |
| 42 | unsigned long write_complete_offset); |
| 43 | |
David S. Miller | 1c03a55 | 2008-09-10 03:15:56 -0700 | [diff] [blame] | 44 | extern void psycho_pbm_init_common(struct pci_pbm_info *pbm, |
Grant Likely | cd4cd73 | 2010-07-22 16:04:30 -0600 | [diff] [blame] | 45 | struct platform_device *op, |
David S. Miller | 1c03a55 | 2008-09-10 03:15:56 -0700 | [diff] [blame] | 46 | const char *chip_name, int chip_type); |
| 47 | |
David S. Miller | a21cff3 | 2008-09-10 03:07:03 -0700 | [diff] [blame] | 48 | #endif /* _PSYCHO_COMMON_H */ |