diff options
Diffstat (limited to 'arch/alpha/kernel/pci-noop.c')
-rw-r--r-- | arch/alpha/kernel/pci-noop.c | 214 |
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 | |||
22 | struct pci_controller *hose_head, **hose_tail = &hose_head; | ||
23 | struct pci_controller *pci_isa_hose; | ||
24 | |||
25 | |||
26 | struct pci_controller * __init | ||
27 | alloc_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 | |||
39 | struct resource * __init | ||
40 | alloc_resource(void) | ||
41 | { | ||
42 | struct resource *res; | ||
43 | |||
44 | res = alloc_bootmem(sizeof(*res)); | ||
45 | |||
46 | return res; | ||
47 | } | ||
48 | |||
49 | asmlinkage long | ||
50 | sys_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 | |||
87 | asmlinkage long | ||
88 | sys_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 | |||
97 | asmlinkage long | ||
98 | sys_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 | |||
109 | void * | ||
110 | pci_alloc_consistent(struct pci_dev *pdev, size_t size, dma_addr_t *dma_addrp) | ||
111 | { | ||
112 | return NULL; | ||
113 | } | ||
114 | |||
115 | void | ||
116 | pci_free_consistent(struct pci_dev *pdev, size_t size, void *cpu_addr, | ||
117 | dma_addr_t dma_addr) | ||
118 | { | ||
119 | } | ||
120 | |||
121 | dma_addr_t | ||
122 | pci_map_single(struct pci_dev *pdev, void *cpu_addr, size_t size, | ||
123 | int direction) | ||
124 | { | ||
125 | return (dma_addr_t) 0; | ||
126 | } | ||
127 | |||
128 | void | ||
129 | pci_unmap_single(struct pci_dev *pdev, dma_addr_t dma_addr, size_t size, | ||
130 | int direction) | ||
131 | { | ||
132 | } | ||
133 | |||
134 | int | ||
135 | pci_map_sg(struct pci_dev *pdev, struct scatterlist *sg, int nents, | ||
136 | int direction) | ||
137 | { | ||
138 | return 0; | ||
139 | } | ||
140 | |||
141 | void | ||
142 | pci_unmap_sg(struct pci_dev *pdev, struct scatterlist *sg, int nents, | ||
143 | int direction) | ||
144 | { | ||
145 | } | ||
146 | |||
147 | int | ||
148 | pci_dma_supported(struct pci_dev *hwdev, dma_addr_t mask) | ||
149 | { | ||
150 | return 0; | ||
151 | } | ||
152 | |||
153 | /* Generic DMA mapping functions: */ | ||
154 | |||
155 | void * | ||
156 | dma_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 | |||
171 | EXPORT_SYMBOL(dma_alloc_coherent); | ||
172 | |||
173 | int | ||
174 | dma_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 | |||
191 | EXPORT_SYMBOL(dma_map_sg); | ||
192 | |||
193 | int | ||
194 | dma_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 | |||
204 | void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen) | ||
205 | { | ||
206 | return NULL; | ||
207 | } | ||
208 | |||
209 | void pci_iounmap(struct pci_dev *dev, void __iomem * addr) | ||
210 | { | ||
211 | } | ||
212 | |||
213 | EXPORT_SYMBOL(pci_iomap); | ||
214 | EXPORT_SYMBOL(pci_iounmap); | ||