1 #ifndef _ASM_IA64_PCI_H
2 #define _ASM_IA64_PCI_H
3
4 #include <linux/slab.h>
5 #include <linux/string.h>
6 #include <linux/types.h>
7 #include <linux/spinlock.h>
8
9 #include <asm/io.h>
10 #include <asm/scatterlist.h>
11
12 /*
13 * Can be used to override the logic in pci_scan_bus for skipping already-configured bus
14 * numbers - to be used for buggy BIOSes or architectures with incomplete PCI setup by the
15 * loader.
16 */
17 #define pcibios_assign_all_busses() 0
18 #define pcibios_scan_all_fns() 0
19
20 #define PCIBIOS_MIN_IO 0x1000
21 #define PCIBIOS_MIN_MEM 0x10000000
22
23 void pcibios_config_init(void);
24 struct pci_bus *pcibios_scan_root(void *acpi_handle, int segment, int bus);
25 extern int (*pci_config_read)(int seg, int bus, int dev, int fn, int reg, int len, u32 *value);
26 extern int (*pci_config_write)(int seg, int bus, int dev, int fn, int reg, int len, u32 value);
27
28 struct pci_dev;
29
30 /*
31 * The PCI address space does equal the physical memory address space.
32 * The networking and block device layers use this boolean for bounce
33 * buffer decisions.
34 */
35 #define PCI_DMA_BUS_IS_PHYS (1)
36
37 static inline void
pcibios_set_master(struct pci_dev * dev)38 pcibios_set_master (struct pci_dev *dev)
39 {
40 /* No special bus mastering setup handling */
41 }
42
43 static inline void
pcibios_penalize_isa_irq(int irq)44 pcibios_penalize_isa_irq (int irq)
45 {
46 /* We don't do dynamic PCI IRQ allocation */
47 }
48
49 #define HAVE_ARCH_PCI_MWI 1
50 extern int pcibios_set_mwi (struct pci_dev *);
51
52 /*
53 * Dynamic DMA mapping API. See Documentation/DMA-mapping.txt for details.
54 */
55 #define pci_alloc_consistent platform_pci_alloc_consistent
56 #define pci_free_consistent platform_pci_free_consistent
57 #define pci_map_single platform_pci_map_single
58 #define pci_unmap_single platform_pci_unmap_single
59 #define pci_map_sg platform_pci_map_sg
60 #define pci_unmap_sg platform_pci_unmap_sg
61 #define pci_dma_sync_single platform_pci_dma_sync_single
62 #define pci_dma_sync_sg platform_pci_dma_sync_sg
63 #define pci_dma_supported platform_pci_dma_supported
64
65 /* pci_unmap_{single,page} is not a nop, thus... */
66 #define DECLARE_PCI_UNMAP_ADDR(addr_name) dma_addr_t addr_name;
67 #define DECLARE_PCI_UNMAP_LEN(len_name) __u32 len_name;
68 #define pci_unmap_addr(ptr, addr_name) ((ptr)->addr_name)
69 #define pci_unmap_addr_set(ptr, addr_name, val) (((ptr)->addr_name) = (val))
70 #define pci_unmap_len(ptr, len_name) ((ptr)->len_name)
71 #define pci_unmap_len_set(ptr, len_name, val) (((ptr)->len_name) = (val))
72
73 #define pci_map_page(dev,pg,off,size,dir) \
74 pci_map_single((dev), page_address(pg) + (off), (size), (dir))
75 #define pci_unmap_page(dev,dma_addr,size,dir) \
76 pci_unmap_single((dev), (dma_addr), (size), (dir))
77
78 /* The ia64 platform always supports 64-bit addressing. */
79 #define pci_dac_dma_supported(pci_dev, mask) (1)
80
81 #define pci_dac_page_to_dma(dev,pg,off,dir) ((dma_addr_t) page_to_bus(pg) + (off))
82 #define pci_dac_dma_to_page(dev,dma_addr) (virt_to_page(bus_to_virt(dma_addr)))
83 #define pci_dac_dma_to_offset(dev,dma_addr) ((dma_addr) & ~PAGE_MASK)
84 #define pci_dac_dma_sync_single(dev,dma_addr,len,dir) do { /* nothing */ } while (0)
85
86 /* Return the PCI domain number */
87 #define pci_controller_num(pdev) (PCI_SEGMENT(pdev))
88
89 #define sg_dma_address(sg) ((sg)->dma_address)
90 #define sg_dma_len(sg) ((sg)->dma_length)
91
92 #define HAVE_PCI_MMAP
93 extern int pci_mmap_page_range (struct pci_dev *dev, struct vm_area_struct *vma,
94 enum pci_mmap_state mmap_state, int write_combine);
95
96 struct pci_window {
97 struct resource resource;
98 u64 offset;
99 };
100
101 struct pci_controller {
102 void *acpi_handle;
103 void *iommu;
104 int segment;
105
106 unsigned int windows;
107 struct pci_window *window;
108
109 void *platform_data;
110 };
111
112 #define PCI_CONTROLLER(dev) ((struct pci_controller *) dev->sysdata)
113 #define PCI_SEGMENT(dev) (PCI_CONTROLLER(dev)->segment)
114
115 #endif /* _ASM_IA64_PCI_H */
116