commented early_printk patch because of rejects.
[linux-flexiantxendom0-3.2.10.git] / include / asm-mips / pci.h
1 /*
2  * This file is subject to the terms and conditions of the GNU General Public
3  * License.  See the file "COPYING" in the main directory of this archive
4  * for more details.
5  */
6 #ifndef _ASM_PCI_H
7 #define _ASM_PCI_H
8
9 #include <linux/config.h>
10 #include <linux/mm.h>
11
12 #ifdef __KERNEL__
13
14 /* Can be used to override the logic in pci_scan_bus for skipping
15    already-configured bus numbers - to be used for buggy BIOSes
16    or architectures with incomplete PCI setup by the loader */
17
18 #ifdef CONFIG_PCI
19 extern unsigned int pcibios_assign_all_busses(void);
20 #else
21 #define pcibios_assign_all_busses()     0
22 #endif
23
24 #define PCIBIOS_MIN_IO          0x1000
25 #define PCIBIOS_MIN_MEM         0x10000000
26
27 static inline void pcibios_set_master(struct pci_dev *dev)
28 {
29         /* No special bus mastering setup handling */
30 }
31
32 static inline void pcibios_penalize_isa_irq(int irq)
33 {
34         /* We don't do dynamic PCI IRQ allocation */
35 }
36
37 /*
38  * Dynamic DMA mapping stuff.
39  * MIPS has everything mapped statically.
40  */
41
42 #include <linux/types.h>
43 #include <linux/slab.h>
44 #include <asm/scatterlist.h>
45 #include <linux/string.h>
46 #include <asm/io.h>
47
48 #if defined(CONFIG_DDB5074) || defined(CONFIG_DDB5476)
49 #undef PCIBIOS_MIN_IO
50 #undef PCIBIOS_MIN_MEM
51 #define PCIBIOS_MIN_IO          0x0100000
52 #define PCIBIOS_MIN_MEM         0x1000000
53 #endif
54
55 struct pci_dev;
56
57 /*
58  * The PCI address space does equal the physical memory address space.  The
59  * networking and block device layers use this boolean for bounce buffer
60  * decisions.
61  */
62 #define PCI_DMA_BUS_IS_PHYS     (1)
63
64 #ifdef CONFIG_MAPPED_DMA_IO
65
66 /* pci_unmap_{single,page} is not a nop, thus... */
67 #define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME)       dma_addr_t ADDR_NAME;
68 #define DECLARE_PCI_UNMAP_LEN(LEN_NAME)         __u32 LEN_NAME;
69 #define pci_unmap_addr(PTR, ADDR_NAME)          ((PTR)->ADDR_NAME)
70 #define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) (((PTR)->ADDR_NAME) = (VAL))
71 #define pci_unmap_len(PTR, LEN_NAME)            ((PTR)->LEN_NAME)
72 #define pci_unmap_len_set(PTR, LEN_NAME, VAL)   (((PTR)->LEN_NAME) = (VAL))
73
74 #else /* CONFIG_MAPPED_DMA_IO  */
75
76 /* pci_unmap_{page,single} is a nop so... */
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
84 #endif /* CONFIG_MAPPED_DMA_IO  */
85
86 /* This is always fine. */
87 #define pci_dac_dma_supported(pci_dev, mask)    (1)
88
89 static inline dma64_addr_t pci_dac_page_to_dma(struct pci_dev *pdev,
90         struct page *page, unsigned long offset, int direction)
91 {
92         dma64_addr_t addr = page_to_phys(page) + offset;
93
94         return (dma64_addr_t) bus_to_baddr(pdev->bus, addr);
95 }
96
97 static inline struct page *pci_dac_dma_to_page(struct pci_dev *pdev,
98         dma64_addr_t dma_addr)
99 {
100         unsigned long poff = baddr_to_bus(pdev->bus, dma_addr) >> PAGE_SHIFT;
101
102         return mem_map + poff;
103 }
104
105 static inline unsigned long pci_dac_dma_to_offset(struct pci_dev *pdev,
106         dma64_addr_t dma_addr)
107 {
108         return dma_addr & ~PAGE_MASK;
109 }
110
111 static inline void pci_dac_dma_sync_single(struct pci_dev *pdev,
112         dma64_addr_t dma_addr, size_t len, int direction)
113 {
114         unsigned long addr;
115
116         if (direction == PCI_DMA_NONE)
117                 BUG();
118
119         addr = baddr_to_bus(pdev->bus, dma_addr) + PAGE_OFFSET;
120         dma_cache_wback_inv(addr, len);
121 }
122
123 #endif /* __KERNEL__ */
124
125 /* implement the pci_ DMA API in terms of the generic device dma_ one */
126 #include <asm-generic/pci-dma-compat.h>
127
128 /* generic pci stuff */
129 #include <asm-generic/pci.h>
130
131 #endif /* _ASM_PCI_H */