aboutsummaryrefslogtreecommitdiffstats
path: root/arch/alpha/kernel/pci-noop.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/alpha/kernel/pci-noop.c')
-rw-r--r--arch/alpha/kernel/pci-noop.c214
1 files changed, 214 insertions, 0 deletions
diff --git a/arch/alpha/kernel/pci-noop.c b/arch/alpha/kernel/pci-noop.c
new file mode 100644
index 000000000000..582a3519fb28
--- /dev/null
+++ b/arch/alpha/kernel/pci-noop.c
@@ -0,0 +1,214 @@
1/*
2 * linux/arch/alpha/kernel/pci-noop.c
3 *
4 * Stub PCI interfaces for Jensen-specific kernels.
5 */
6
7#include <linux/pci.h>
8#include <linux/init.h>
9#include <linux/bootmem.h>
10#include <linux/mm.h>
11#include <linux/errno.h>
12#include <linux/sched.h>
13#include <linux/dma-mapping.h>
14
15#include "proto.h"
16
17
18/*
19 * The PCI controller list.
20 */
21
22struct pci_controller *hose_head, **hose_tail = &hose_head;
23struct pci_controller *pci_isa_hose;
24
25
26struct pci_controller * __init
27alloc_pci_controller(void)
28{
29 struct pci_controller *hose;
30
31 hose = alloc_bootmem(sizeof(*hose));
32
33 *hose_tail = hose;
34 hose_tail = &hose->next;
35
36 return hose;
37}
38
39struct resource * __init
40alloc_resource(void)
41{
42 struct resource *res;
43
44 res = alloc_bootmem(sizeof(*res));
45
46 return res;
47}
48
49asmlinkage long
50sys_pciconfig_iobase(long which, unsigned long bus, unsigned long dfn)
51{
52 struct pci_controller *hose;
53
54 /* from hose or from bus.devfn */
55 if (which & IOBASE_FROM_HOSE) {
56 for (hose = hose_head; hose; hose = hose->next)
57 if (hose->index == bus)
58 break;
59 if (!hose)
60 return -ENODEV;
61 } else {
62 /* Special hook for ISA access. */
63 if (bus == 0 && dfn == 0)
64 hose = pci_isa_hose;
65 else
66 return -ENODEV;
67 }
68
69 switch (which & ~IOBASE_FROM_HOSE) {
70 case IOBASE_HOSE:
71 return hose->index;
72 case IOBASE_SPARSE_MEM:
73 return hose->sparse_mem_base;
74 case IOBASE_DENSE_MEM:
75 return hose->dense_mem_base;
76 case IOBASE_SPARSE_IO:
77 return hose->sparse_io_base;
78 case IOBASE_DENSE_IO:
79 return hose->dense_io_base;
80 case IOBASE_ROOT_BUS:
81 return hose->bus->number;
82 }
83
84 return -EOPNOTSUPP;
85}
86
87asmlinkage long
88sys_pciconfig_read(unsigned long bus, unsigned long dfn,
89 unsigned long off, unsigned long len, void *buf)
90{
91 if (!capable(CAP_SYS_ADMIN))
92 return -EPERM;
93 else
94 return -ENODEV;
95}
96
97asmlinkage long
98sys_pciconfig_write(unsigned long bus, unsigned long dfn,
99 unsigned long off, unsigned long len, void *buf)
100{
101 if (!capable(CAP_SYS_ADMIN))
102 return -EPERM;
103 else
104 return -ENODEV;
105}
106
107/* Stubs for the routines in pci_iommu.c: */
108
109void *
110pci_alloc_consistent(struct pci_dev *pdev, size_t size, dma_addr_t *dma_addrp)
111{
112 return NULL;
113}
114
115void
116pci_free_consistent(struct pci_dev *pdev, size_t size, void *cpu_addr,
117 dma_addr_t dma_addr)
118{
119}
120
121dma_addr_t
122pci_map_single(struct pci_dev *pdev, void *cpu_addr, size_t size,
123 int direction)
124{
125 return (dma_addr_t) 0;
126}
127
128void
129pci_unmap_single(struct pci_dev *pdev, dma_addr_t dma_addr, size_t size,
130 int direction)
131{
132}
133
134int
135pci_map_sg(struct pci_dev *pdev, struct scatterlist *sg, int nents,
136 int direction)
137{
138 return 0;
139}
140
141void
142pci_unmap_sg(struct pci_dev *pdev, struct scatterlist *sg, int nents,
143 int direction)
144{
145}
146
147int
148pci_dma_supported(struct pci_dev *hwdev, dma_addr_t mask)
149{
150 return 0;
151}
152
153/* Generic DMA mapping functions: */
154
155void *
156dma_alloc_coherent(struct device *dev, size_t size,
157 dma_addr_t *dma_handle, int gfp)
158{
159 void *ret;
160
161 if (!dev || *dev->dma_mask >= 0xffffffffUL)
162 gfp &= ~GFP_DMA;
163 ret = (void *)__get_free_pages(gfp, get_order(size));
164 if (ret) {
165 memset(ret, 0, size);
166 *dma_handle = virt_to_bus(ret);
167 }
168 return ret;
169}
170
171EXPORT_SYMBOL(dma_alloc_coherent);
172
173int
174dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
175 enum dma_data_direction direction)
176{
177 int i;
178
179 for (i = 0; i < nents; i++ ) {
180 void *va;
181
182 BUG_ON(!sg[i].page);
183 va = page_address(sg[i].page) + sg[i].offset;
184 sg_dma_address(sg + i) = (dma_addr_t)virt_to_bus(va);
185 sg_dma_len(sg + i) = sg[i].length;
186 }
187
188 return nents;
189}
190
191EXPORT_SYMBOL(dma_map_sg);
192
193int
194dma_set_mask(struct device *dev, u64 mask)
195{
196 if (!dev->dma_mask || !dma_supported(dev, mask))
197 return -EIO;
198
199 *dev->dma_mask = mask;
200
201 return 0;
202}
203
204void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen)
205{
206 return NULL;
207}
208
209void pci_iounmap(struct pci_dev *dev, void __iomem * addr)
210{
211}
212
213EXPORT_SYMBOL(pci_iomap);
214EXPORT_SYMBOL(pci_iounmap);