1 #ifndef __POWERNV_PCI_H
2 #define __POWERNV_PCI_H
12 /* Precise PHB model for error management */
14 PNV_PHB_MODEL_UNKNOWN
,
19 #define PNV_PCI_DIAG_BUF_SIZE 4096
21 /* Data associated with a PE, including IOMMU tracking etc.. */
23 /* A PE can be associated with a single device or an
24 * entire bus (& children). In the former case, pdev
25 * is populated, in the later case, pbus is.
30 /* Effective RID (device RID for a device PE and base bus
31 * RID with devfn 0 for a bus PE)
36 unsigned int pe_number
;
38 /* "Weight" assigned to the PE for the sake of DMA resource
41 unsigned int dma_weight
;
43 /* This is a PCI-E -> PCI-X bridge, this points to the
44 * corresponding bus PE
46 struct pnv_ioda_pe
*bus_pe
;
48 /* "Base" iommu table, ie, 4K TCEs, 32-bit DMA */
51 struct iommu_table tce32_table
;
53 /* XXX TODO: Add support for additional 64-bit iommus */
55 /* MSIs. MVE index is identical for for 32 and 64 bit MSI
56 * and -1 if not supported. (It's actually identical to the
61 /* Link in list of PE#s */
62 struct list_head link
;
66 struct pci_controller
*hose
;
67 enum pnv_phb_type type
;
68 enum pnv_phb_model model
;
74 unsigned long *msi_map
;
75 unsigned int msi_base
;
76 unsigned int msi_count
;
77 unsigned int msi_next
;
78 unsigned int msi32_support
;
80 int (*msi_setup
)(struct pnv_phb
*phb
, struct pci_dev
*dev
,
81 unsigned int hwirq
, unsigned int is_64
,
83 void (*dma_dev_setup
)(struct pnv_phb
*phb
, struct pci_dev
*pdev
);
84 void (*fixup_phb
)(struct pci_controller
*hose
);
85 u32 (*bdfn_to_pe
)(struct pnv_phb
*phb
, struct pci_bus
*bus
, u32 devfn
);
89 struct iommu_table iommu_table
;
93 /* Global bridge info */
94 unsigned int total_pe
;
95 unsigned int m32_size
;
96 unsigned int m32_segsize
;
97 unsigned int m32_pci_base
;
99 unsigned int io_segsize
;
100 unsigned int io_pci_base
;
102 /* PE allocation bitmap */
103 unsigned long *pe_alloc
;
105 /* M32 & IO segment maps */
106 unsigned int *m32_segmap
;
107 unsigned int *io_segmap
;
108 struct pnv_ioda_pe
*pe_array
;
110 /* Reverse map of PEs, will have to extend if
111 * we are to support more than 256 PEs, indexed
114 unsigned char pe_rmap
[0x10000];
116 /* 32-bit TCE tables allocation */
117 unsigned long tce32_count
;
119 /* Total "weight" for the sake of DMA resources
122 unsigned int dma_weight
;
123 unsigned int dma_pe_count
;
125 /* Sorted list of used PE's, sorted at
126 * boot for resource allocation purposes
128 struct list_head pe_list
;
132 /* PHB status structure */
134 unsigned char blob
[PNV_PCI_DIAG_BUF_SIZE
];
135 struct OpalIoP7IOCPhbErrorData p7ioc
;
139 extern struct pci_ops pnv_pci_ops
;
141 extern void pnv_pci_setup_iommu_table(struct iommu_table
*tbl
,
142 void *tce_mem
, u64 tce_size
,
144 extern void pnv_pci_init_p5ioc2_hub(struct device_node
*np
);
145 extern void pnv_pci_init_ioda_hub(struct device_node
*np
);
148 #endif /* __POWERNV_PCI_H */