2 * linux/arch/alpha/kernel/pci-noop.c
4 * Stub PCI interfaces for Jensen-specific kernels.
8 #include <linux/init.h>
9 #include <linux/bootmem.h>
10 #include <linux/capability.h>
12 #include <linux/errno.h>
13 #include <linux/sched.h>
14 #include <linux/dma-mapping.h>
15 #include <linux/scatterlist.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));
36 hose_tail = &hose->next;
41 struct resource * __init
46 res = alloc_bootmem(sizeof(*res));
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)
64 /* Special hook for ISA access. */
65 if (bus == 0 && dfn == 0)
71 switch (which & ~IOBASE_FROM_HOSE) {
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;
81 return hose->dense_io_base;
83 return hose->bus->number;
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))
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))
109 /* Stubs for the routines in pci_iommu.c: */
112 __pci_alloc_consistent(struct pci_dev *pdev, size_t size,
113 dma_addr_t *dma_addrp, gfp_t gfp)
119 pci_free_consistent(struct pci_dev *pdev, size_t size, void *cpu_addr,
125 pci_map_single(struct pci_dev *pdev, void *cpu_addr, size_t size,
128 return (dma_addr_t) 0;
132 pci_unmap_single(struct pci_dev *pdev, dma_addr_t dma_addr, size_t size,
138 pci_map_sg(struct pci_dev *pdev, struct scatterlist *sg, int nents,
145 pci_unmap_sg(struct pci_dev *pdev, struct scatterlist *sg, int nents,
151 pci_dma_supported(struct pci_dev *hwdev, dma_addr_t mask)
156 /* Generic DMA mapping functions: */
159 dma_alloc_coherent(struct device *dev, size_t size,
160 dma_addr_t *dma_handle, gfp_t gfp)
164 if (!dev || *dev->dma_mask >= 0xffffffffUL)
166 ret = (void *)__get_free_pages(gfp, get_order(size));
168 memset(ret, 0, size);
169 *dma_handle = virt_to_phys(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)
181 struct scatterlist *sg;
183 for_each_sg(sgl, sg, nents, i) {
186 BUG_ON(!sg_page(sg));
188 sg_dma_address(sg) = (dma_addr_t)virt_to_phys(va);
189 sg_dma_len(sg) = sg->length;
195 EXPORT_SYMBOL(dma_map_sg);
198 dma_set_mask(struct device *dev, u64 mask)
200 if (!dev->dma_mask || !dma_supported(dev, mask))
203 *dev->dma_mask = mask;
207 EXPORT_SYMBOL(dma_set_mask);
209 void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen)
214 void pci_iounmap(struct pci_dev *dev, void __iomem * addr)
218 EXPORT_SYMBOL(pci_iomap);
219 EXPORT_SYMBOL(pci_iounmap);