Linux v2.6.13-rc3
[pohmelfs.git] / arch / alpha / kernel / pci-noop.c
blob582a3519fb28d24bbf42dd8e1cb46c700b5f2c22
1 /*
2 * linux/arch/alpha/kernel/pci-noop.c
4 * Stub PCI interfaces for Jensen-specific kernels.
5 */
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>
15 #include "proto.h"
19 * The PCI controller list.
22 struct pci_controller *hose_head, **hose_tail = &hose_head;
23 struct pci_controller *pci_isa_hose;
26 struct pci_controller * __init
27 alloc_pci_controller(void)
29 struct pci_controller *hose;
31 hose = alloc_bootmem(sizeof(*hose));
33 *hose_tail = hose;
34 hose_tail = &hose->next;
36 return hose;
39 struct resource * __init
40 alloc_resource(void)
42 struct resource *res;
44 res = alloc_bootmem(sizeof(*res));
46 return res;
49 asmlinkage long
50 sys_pciconfig_iobase(long which, unsigned long bus, unsigned long dfn)
52 struct pci_controller *hose;
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;
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;
84 return -EOPNOTSUPP;
87 asmlinkage long
88 sys_pciconfig_read(unsigned long bus, unsigned long dfn,
89 unsigned long off, unsigned long len, void *buf)
91 if (!capable(CAP_SYS_ADMIN))
92 return -EPERM;
93 else
94 return -ENODEV;
97 asmlinkage long
98 sys_pciconfig_write(unsigned long bus, unsigned long dfn,
99 unsigned long off, unsigned long len, void *buf)
101 if (!capable(CAP_SYS_ADMIN))
102 return -EPERM;
103 else
104 return -ENODEV;
107 /* Stubs for the routines in pci_iommu.c: */
109 void *
110 pci_alloc_consistent(struct pci_dev *pdev, size_t size, dma_addr_t *dma_addrp)
112 return NULL;
115 void
116 pci_free_consistent(struct pci_dev *pdev, size_t size, void *cpu_addr,
117 dma_addr_t dma_addr)
121 dma_addr_t
122 pci_map_single(struct pci_dev *pdev, void *cpu_addr, size_t size,
123 int direction)
125 return (dma_addr_t) 0;
128 void
129 pci_unmap_single(struct pci_dev *pdev, dma_addr_t dma_addr, size_t size,
130 int direction)
135 pci_map_sg(struct pci_dev *pdev, struct scatterlist *sg, int nents,
136 int direction)
138 return 0;
141 void
142 pci_unmap_sg(struct pci_dev *pdev, struct scatterlist *sg, int nents,
143 int direction)
148 pci_dma_supported(struct pci_dev *hwdev, dma_addr_t mask)
150 return 0;
153 /* Generic DMA mapping functions: */
155 void *
156 dma_alloc_coherent(struct device *dev, size_t size,
157 dma_addr_t *dma_handle, int gfp)
159 void *ret;
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);
168 return ret;
171 EXPORT_SYMBOL(dma_alloc_coherent);
174 dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
175 enum dma_data_direction direction)
177 int i;
179 for (i = 0; i < nents; i++ ) {
180 void *va;
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;
188 return nents;
191 EXPORT_SYMBOL(dma_map_sg);
194 dma_set_mask(struct device *dev, u64 mask)
196 if (!dev->dma_mask || !dma_supported(dev, mask))
197 return -EIO;
199 *dev->dma_mask = mask;
201 return 0;
204 void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen)
206 return NULL;
209 void pci_iounmap(struct pci_dev *dev, void __iomem * addr)
213 EXPORT_SYMBOL(pci_iomap);
214 EXPORT_SYMBOL(pci_iounmap);