ocfs2: Add reflinked file's inode to inode hash eariler.
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / arch / alpha / kernel / pci-noop.c
blobc19a376520f45e3d3b89c6d749117a77727443f0
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/capability.h>
11 #include <linux/mm.h>
12 #include <linux/errno.h>
13 #include <linux/sched.h>
14 #include <linux/dma-mapping.h>
15 #include <linux/scatterlist.h>
17 #include "proto.h"
21 * The PCI controller list.
24 struct pci_controller *hose_head, **hose_tail = &hose_head;
25 struct pci_controller *pci_isa_hose;
28 struct pci_controller * __init
29 alloc_pci_controller(void)
31 struct pci_controller *hose;
33 hose = alloc_bootmem(sizeof(*hose));
35 *hose_tail = hose;
36 hose_tail = &hose->next;
38 return hose;
41 struct resource * __init
42 alloc_resource(void)
44 struct resource *res;
46 res = alloc_bootmem(sizeof(*res));
48 return res;
51 asmlinkage long
52 sys_pciconfig_iobase(long which, unsigned long bus, unsigned long dfn)
54 struct pci_controller *hose;
56 /* from hose or from bus.devfn */
57 if (which & IOBASE_FROM_HOSE) {
58 for (hose = hose_head; hose; hose = hose->next)
59 if (hose->index == bus)
60 break;
61 if (!hose)
62 return -ENODEV;
63 } else {
64 /* Special hook for ISA access. */
65 if (bus == 0 && dfn == 0)
66 hose = pci_isa_hose;
67 else
68 return -ENODEV;
71 switch (which & ~IOBASE_FROM_HOSE) {
72 case IOBASE_HOSE:
73 return hose->index;
74 case IOBASE_SPARSE_MEM:
75 return hose->sparse_mem_base;
76 case IOBASE_DENSE_MEM:
77 return hose->dense_mem_base;
78 case IOBASE_SPARSE_IO:
79 return hose->sparse_io_base;
80 case IOBASE_DENSE_IO:
81 return hose->dense_io_base;
82 case IOBASE_ROOT_BUS:
83 return hose->bus->number;
86 return -EOPNOTSUPP;
89 asmlinkage long
90 sys_pciconfig_read(unsigned long bus, unsigned long dfn,
91 unsigned long off, unsigned long len, void *buf)
93 if (!capable(CAP_SYS_ADMIN))
94 return -EPERM;
95 else
96 return -ENODEV;
99 asmlinkage long
100 sys_pciconfig_write(unsigned long bus, unsigned long dfn,
101 unsigned long off, unsigned long len, void *buf)
103 if (!capable(CAP_SYS_ADMIN))
104 return -EPERM;
105 else
106 return -ENODEV;
109 /* Stubs for the routines in pci_iommu.c: */
111 void *
112 __pci_alloc_consistent(struct pci_dev *pdev, size_t size,
113 dma_addr_t *dma_addrp, gfp_t gfp)
115 return NULL;
118 void
119 pci_free_consistent(struct pci_dev *pdev, size_t size, void *cpu_addr,
120 dma_addr_t dma_addr)
124 dma_addr_t
125 pci_map_single(struct pci_dev *pdev, void *cpu_addr, size_t size,
126 int direction)
128 return (dma_addr_t) 0;
131 void
132 pci_unmap_single(struct pci_dev *pdev, dma_addr_t dma_addr, size_t size,
133 int direction)
138 pci_map_sg(struct pci_dev *pdev, struct scatterlist *sg, int nents,
139 int direction)
141 return 0;
144 void
145 pci_unmap_sg(struct pci_dev *pdev, struct scatterlist *sg, int nents,
146 int direction)
151 pci_dma_supported(struct pci_dev *hwdev, dma_addr_t mask)
153 return 0;
156 /* Generic DMA mapping functions: */
158 void *
159 dma_alloc_coherent(struct device *dev, size_t size,
160 dma_addr_t *dma_handle, gfp_t gfp)
162 void *ret;
164 if (!dev || *dev->dma_mask >= 0xffffffffUL)
165 gfp &= ~GFP_DMA;
166 ret = (void *)__get_free_pages(gfp, get_order(size));
167 if (ret) {
168 memset(ret, 0, size);
169 *dma_handle = virt_to_phys(ret);
171 return ret;
174 EXPORT_SYMBOL(dma_alloc_coherent);
177 dma_map_sg(struct device *dev, struct scatterlist *sgl, int nents,
178 enum dma_data_direction direction)
180 int i;
181 struct scatterlist *sg;
183 for_each_sg(sgl, sg, nents, i) {
184 void *va;
186 BUG_ON(!sg_page(sg));
187 va = sg_virt(sg);
188 sg_dma_address(sg) = (dma_addr_t)virt_to_phys(va);
189 sg_dma_len(sg) = sg->length;
192 return nents;
195 EXPORT_SYMBOL(dma_map_sg);
198 dma_set_mask(struct device *dev, u64 mask)
200 if (!dev->dma_mask || !dma_supported(dev, mask))
201 return -EIO;
203 *dev->dma_mask = mask;
205 return 0;
207 EXPORT_SYMBOL(dma_set_mask);
209 void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen)
211 return NULL;
214 void pci_iounmap(struct pci_dev *dev, void __iomem * addr)
218 EXPORT_SYMBOL(pci_iomap);
219 EXPORT_SYMBOL(pci_iounmap);