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
9 #include <linux/config.h>
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 */
19 extern unsigned int pcibios_assign_all_busses(void);
21 #define pcibios_assign_all_busses() 0
24 #define PCIBIOS_MIN_IO 0x1000
25 #define PCIBIOS_MIN_MEM 0x10000000
27 static inline void pcibios_set_master(struct pci_dev *dev)
29 /* No special bus mastering setup handling */
32 static inline void pcibios_penalize_isa_irq(int irq)
34 /* We don't do dynamic PCI IRQ allocation */
38 * Dynamic DMA mapping stuff.
39 * MIPS has everything mapped statically.
42 #include <linux/types.h>
43 #include <linux/slab.h>
44 #include <asm/scatterlist.h>
45 #include <linux/string.h>
48 #if defined(CONFIG_DDB5074) || defined(CONFIG_DDB5476)
50 #undef PCIBIOS_MIN_MEM
51 #define PCIBIOS_MIN_IO 0x0100000
52 #define PCIBIOS_MIN_MEM 0x1000000
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
62 #define PCI_DMA_BUS_IS_PHYS (1)
64 #ifdef CONFIG_MAPPED_DMA_IO
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))
74 #else /* CONFIG_MAPPED_DMA_IO */
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)
84 #endif /* CONFIG_MAPPED_DMA_IO */
86 /* This is always fine. */
87 #define pci_dac_dma_supported(pci_dev, mask) (1)
89 static inline dma64_addr_t pci_dac_page_to_dma(struct pci_dev *pdev,
90 struct page *page, unsigned long offset, int direction)
92 dma64_addr_t addr = page_to_phys(page) + offset;
94 return (dma64_addr_t) bus_to_baddr(pdev->bus, addr);
97 static inline struct page *pci_dac_dma_to_page(struct pci_dev *pdev,
98 dma64_addr_t dma_addr)
100 unsigned long poff = baddr_to_bus(pdev->bus, dma_addr) >> PAGE_SHIFT;
102 return mem_map + poff;
105 static inline unsigned long pci_dac_dma_to_offset(struct pci_dev *pdev,
106 dma64_addr_t dma_addr)
108 return dma_addr & ~PAGE_MASK;
111 static inline void pci_dac_dma_sync_single(struct pci_dev *pdev,
112 dma64_addr_t dma_addr, size_t len, int direction)
116 if (direction == PCI_DMA_NONE)
119 addr = baddr_to_bus(pdev->bus, dma_addr) + PAGE_OFFSET;
120 dma_cache_wback_inv(addr, len);
123 #endif /* __KERNEL__ */
125 /* implement the pci_ DMA API in terms of the generic device dma_ one */
126 #include <asm-generic/pci-dma-compat.h>
128 /* generic pci stuff */
129 #include <asm-generic/pci.h>
131 #endif /* _ASM_PCI_H */