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/gfp.h>
11 #include <linux/capability.h>
13 #include <linux/errno.h>
14 #include <linux/sched.h>
15 #include <linux/dma-mapping.h>
16 #include <linux/scatterlist.h>
22 * The PCI controller list.
25 struct pci_controller *hose_head, **hose_tail = &hose_head;
26 struct pci_controller *pci_isa_hose;
29 struct pci_controller * __init
30 alloc_pci_controller(void)
32 struct pci_controller *hose;
34 hose = alloc_bootmem(sizeof(*hose));
37 hose_tail = &hose->next;
42 struct resource * __init
47 res = alloc_bootmem(sizeof(*res));
53 sys_pciconfig_iobase(long which, unsigned long bus, unsigned long dfn)
55 struct pci_controller *hose;
57 /* from hose or from bus.devfn */
58 if (which & IOBASE_FROM_HOSE) {
59 for (hose = hose_head; hose; hose = hose->next)
60 if (hose->index == bus)
65 /* Special hook for ISA access. */
66 if (bus == 0 && dfn == 0)
72 switch (which & ~IOBASE_FROM_HOSE) {
75 case IOBASE_SPARSE_MEM:
76 return hose->sparse_mem_base;
77 case IOBASE_DENSE_MEM:
78 return hose->dense_mem_base;
79 case IOBASE_SPARSE_IO:
80 return hose->sparse_io_base;
82 return hose->dense_io_base;
84 return hose->bus->number;
91 sys_pciconfig_read(unsigned long bus, unsigned long dfn,
92 unsigned long off, unsigned long len, void *buf)
94 if (!capable(CAP_SYS_ADMIN))
101 sys_pciconfig_write(unsigned long bus, unsigned long dfn,
102 unsigned long off, unsigned long len, void *buf)
104 if (!capable(CAP_SYS_ADMIN))
110 static void *alpha_noop_alloc_coherent(struct device *dev, size_t size,
111 dma_addr_t *dma_handle, gfp_t gfp,
116 if (!dev || *dev->dma_mask >= 0xffffffffUL)
118 ret = (void *)__get_free_pages(gfp, get_order(size));
120 memset(ret, 0, size);
121 *dma_handle = virt_to_phys(ret);
126 static int alpha_noop_supported(struct device *dev, u64 mask)
128 return mask < 0x00ffffffUL ? 0 : 1;
131 struct dma_map_ops alpha_noop_ops = {
132 .alloc = alpha_noop_alloc_coherent,
133 .free = dma_noop_free_coherent,
134 .map_page = dma_noop_map_page,
135 .map_sg = dma_noop_map_sg,
136 .mapping_error = dma_noop_mapping_error,
137 .dma_supported = alpha_noop_supported,
140 struct dma_map_ops *dma_ops = &alpha_noop_ops;
141 EXPORT_SYMBOL(dma_ops);