Linux-2.6.12-rc2
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / include / asm-sh / pci.h
1 #ifndef __ASM_SH_PCI_H
2 #define __ASM_SH_PCI_H
3
4 #ifdef __KERNEL__
5
6 #include <linux/dma-mapping.h>
7
8 /* Can be used to override the logic in pci_scan_bus for skipping
9 already-configured bus numbers - to be used for buggy BIOSes
10 or architectures with incomplete PCI setup by the loader */
11
12 #define pcibios_assign_all_busses() 1
13 #define pcibios_scan_all_fns(a, b) 0
14
15 /*
16 * A board can define one or more PCI channels that represent built-in (or
17 * external) PCI controllers.
18 */
19 struct pci_channel {
20 struct pci_ops *pci_ops;
21 struct resource *io_resource;
22 struct resource *mem_resource;
23 int first_devfn;
24 int last_devfn;
25 };
26
27 /*
28 * Each board initializes this array and terminates it with a NULL entry.
29 */
30 extern struct pci_channel board_pci_channels[];
31
32 #define PCIBIOS_MIN_IO board_pci_channels->io_resource->start
33 #define PCIBIOS_MIN_MEM board_pci_channels->mem_resource->start
34
35 struct pci_dev;
36
37 extern void pcibios_set_master(struct pci_dev *dev);
38
39 static inline void pcibios_penalize_isa_irq(int irq)
40 {
41 /* We don't do dynamic PCI IRQ allocation */
42 }
43
44 /* Dynamic DMA mapping stuff.
45 * SuperH has everything mapped statically like x86.
46 */
47
48 /* The PCI address space does equal the physical memory
49 * address space. The networking and block device layers use
50 * this boolean for bounce buffer decisions.
51 */
52 #define PCI_DMA_BUS_IS_PHYS (1)
53
54 #include <linux/types.h>
55 #include <linux/slab.h>
56 #include <asm/scatterlist.h>
57 #include <linux/string.h>
58 #include <asm/io.h>
59
60 /* pci_unmap_{single,page} being a nop depends upon the
61 * configuration.
62 */
63 #ifdef CONFIG_SH_PCIDMA_NONCOHERENT
64 #define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) \
65 dma_addr_t ADDR_NAME;
66 #define DECLARE_PCI_UNMAP_LEN(LEN_NAME) \
67 __u32 LEN_NAME;
68 #define pci_unmap_addr(PTR, ADDR_NAME) \
69 ((PTR)->ADDR_NAME)
70 #define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) \
71 (((PTR)->ADDR_NAME) = (VAL))
72 #define pci_unmap_len(PTR, LEN_NAME) \
73 ((PTR)->LEN_NAME)
74 #define pci_unmap_len_set(PTR, LEN_NAME, VAL) \
75 (((PTR)->LEN_NAME) = (VAL))
76 #else
77 #define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME)
78 #define DECLARE_PCI_UNMAP_LEN(LEN_NAME)
79 #define pci_unmap_addr(PTR, ADDR_NAME) (0)
80 #define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) do { } while (0)
81 #define pci_unmap_len(PTR, LEN_NAME) (0)
82 #define pci_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0)
83 #endif
84
85 /* Not supporting more than 32-bit PCI bus addresses now, but
86 * must satisfy references to this function. Change if needed.
87 */
88 #define pci_dac_dma_supported(pci_dev, mask) (0)
89
90 /* These macros should be used after a pci_map_sg call has been done
91 * to get bus addresses of each of the SG entries and their lengths.
92 * You should only work with the number of sg entries pci_map_sg
93 * returns, or alternatively stop on the first sg_dma_len(sg) which
94 * is 0.
95 */
96 #define sg_dma_address(sg) (virt_to_bus((sg)->dma_address))
97 #define sg_dma_len(sg) ((sg)->length)
98
99 /* Board-specific fixup routines. */
100 extern void pcibios_fixup(void);
101 extern void pcibios_fixup_irqs(void);
102
103 #ifdef CONFIG_PCI_AUTO
104 extern int pciauto_assign_resources(int busno, struct pci_channel *hose);
105 #endif
106
107 static inline void pcibios_add_platform_entries(struct pci_dev *dev)
108 {
109 }
110
111 #endif /* __KERNEL__ */
112
113 /* generic pci stuff */
114 #include <asm-generic/pci.h>
115
116 /* generic DMA-mapping stuff */
117 #include <asm-generic/pci-dma-compat.h>
118
119 #endif /* __ASM_SH_PCI_H */
120