[ACPI] merge acpi-2.6.12 branch into latest Linux 2.6.13-rc...
[pandora-kernel.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, int active)
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 #ifdef CONFIG_PCI
100 static inline void pci_dma_burst_advice(struct pci_dev *pdev,
101                                         enum pci_dma_burst_strategy *strat,
102                                         unsigned long *strategy_parameter)
103 {
104         *strat = PCI_DMA_BURST_INFINITY;
105         *strategy_parameter = ~0UL;
106 }
107 #endif
108
109 /* Board-specific fixup routines. */
110 extern void pcibios_fixup(void);
111 extern void pcibios_fixup_irqs(void);
112
113 #ifdef CONFIG_PCI_AUTO
114 extern int pciauto_assign_resources(int busno, struct pci_channel *hose);
115 #endif
116
117 static inline void pcibios_add_platform_entries(struct pci_dev *dev)
118 {
119 }
120
121 #endif /* __KERNEL__ */
122
123 /* generic pci stuff */
124 #include <asm-generic/pci.h>
125
126 /* generic DMA-mapping stuff */
127 #include <asm-generic/pci-dma-compat.h>
128
129 #endif /* __ASM_SH_PCI_H */
130