PCI: Use a weak symbol for the empty version of pcibios_add_platform_entries()
[powerpc.git] / include / asm-frv / pci.h
1 /* pci.h: FR-V specific PCI declarations
2  *
3  * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved.
4  * Written by David Howells (dhowells@redhat.com)
5  * - Derived from include/asm-m68k/pci.h
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version
10  * 2 of the License, or (at your option) any later version.
11  */
12
13 #ifndef ASM_PCI_H
14 #define ASM_PCI_H
15
16 #include <linux/mm.h>
17 #include <asm/scatterlist.h>
18 #include <asm-generic/pci-dma-compat.h>
19 #include <asm-generic/pci.h>
20
21 struct pci_dev;
22
23 #define pcibios_assign_all_busses()     0
24
25 extern void pcibios_set_master(struct pci_dev *dev);
26
27 extern void pcibios_penalize_isa_irq(int irq);
28
29 #ifdef CONFIG_MMU
30 extern void *consistent_alloc(gfp_t gfp, size_t size, dma_addr_t *dma_handle);
31 extern void consistent_free(void *vaddr);
32 extern void consistent_sync(void *vaddr, size_t size, int direction);
33 extern void consistent_sync_page(struct page *page, unsigned long offset,
34                                  size_t size, int direction);
35 #endif
36
37 extern void *pci_alloc_consistent(struct pci_dev *hwdev, size_t size,
38                                   dma_addr_t *dma_handle);
39
40 extern void pci_free_consistent(struct pci_dev *hwdev, size_t size,
41                                 void *vaddr, dma_addr_t dma_handle);
42
43 /* This is always fine. */
44 #define pci_dac_dma_supported(pci_dev, mask)    (1)
45
46 /* Return the index of the PCI controller for device PDEV. */
47 #define pci_controller_num(PDEV)        (0)
48
49 /* The PCI address space does equal the physical memory
50  * address space.  The networking and block device layers use
51  * this boolean for bounce buffer decisions.
52  */
53 #define PCI_DMA_BUS_IS_PHYS     (1)
54
55 /* pci_unmap_{page,single} is a nop so... */
56 #define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME)
57 #define DECLARE_PCI_UNMAP_LEN(LEN_NAME)
58 #define pci_unmap_addr(PTR, ADDR_NAME)          (0)
59 #define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) do { } while (0)
60 #define pci_unmap_len(PTR, LEN_NAME)            (0)
61 #define pci_unmap_len_set(PTR, LEN_NAME, VAL)   do { } while (0)
62
63 #ifdef CONFIG_PCI
64 static inline void pci_dma_burst_advice(struct pci_dev *pdev,
65                                         enum pci_dma_burst_strategy *strat,
66                                         unsigned long *strategy_parameter)
67 {
68         *strat = PCI_DMA_BURST_INFINITY;
69         *strategy_parameter = ~0UL;
70 }
71 #endif
72
73 /*
74  *      These are pretty much arbitary with the CoMEM implementation.
75  *      We have the whole address space to ourselves.
76  */
77 #define PCIBIOS_MIN_IO          0x100
78 #define PCIBIOS_MIN_MEM         0x00010000
79
80 /* Make physical memory consistent for a single
81  * streaming mode DMA translation after a transfer.
82  *
83  * If you perform a pci_map_single() but wish to interrogate the
84  * buffer using the cpu, yet do not wish to teardown the PCI dma
85  * mapping, you must call this function before doing so.  At the
86  * next point you give the PCI dma address back to the card, the
87  * device again owns the buffer.
88  */
89 static inline void pci_dma_sync_single(struct pci_dev *hwdev,
90                                        dma_addr_t dma_handle,
91                                        size_t size, int direction)
92 {
93         if (direction == PCI_DMA_NONE)
94                 BUG();
95
96         frv_cache_wback_inv((unsigned long)bus_to_virt(dma_handle),
97                             (unsigned long)bus_to_virt(dma_handle) + size);
98 }
99
100 /* Make physical memory consistent for a set of streaming
101  * mode DMA translations after a transfer.
102  *
103  * The same as pci_dma_sync_single but for a scatter-gather list,
104  * same rules and usage.
105  */
106 static inline void pci_dma_sync_sg(struct pci_dev *hwdev,
107                                    struct scatterlist *sg,
108                                    int nelems, int direction)
109 {
110         int i;
111
112         if (direction == PCI_DMA_NONE)
113                 BUG();
114
115         for (i = 0; i < nelems; i++)
116                 frv_cache_wback_inv(sg_dma_address(&sg[i]),
117                                     sg_dma_address(&sg[i])+sg_dma_len(&sg[i]));
118 }
119
120
121 #endif