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
, dma_addr_t
*dma_addrp
)
118 pci_free_consistent(struct pci_dev
*pdev
, size_t size
, void *cpu_addr
,
124 pci_map_single(struct pci_dev
*pdev
, void *cpu_addr
, size_t size
,
127 return (dma_addr_t
) 0;
131 pci_unmap_single(struct pci_dev
*pdev
, dma_addr_t dma_addr
, size_t size
,
137 pci_map_sg(struct pci_dev
*pdev
, struct scatterlist
*sg
, int nents
,
144 pci_unmap_sg(struct pci_dev
*pdev
, struct scatterlist
*sg
, int nents
,
150 pci_dma_supported(struct pci_dev
*hwdev
, dma_addr_t mask
)
155 /* Generic DMA mapping functions: */
158 dma_alloc_coherent(struct device
*dev
, size_t size
,
159 dma_addr_t
*dma_handle
, gfp_t gfp
)
163 if (!dev
|| *dev
->dma_mask
>= 0xffffffffUL
)
165 ret
= (void *)__get_free_pages(gfp
, get_order(size
));
167 memset(ret
, 0, size
);
168 *dma_handle
= virt_to_phys(ret
);
173 EXPORT_SYMBOL(dma_alloc_coherent
);
176 dma_map_sg(struct device
*dev
, struct scatterlist
*sgl
, int nents
,
177 enum dma_data_direction direction
)
180 struct scatterlist
*sg
;
182 for_each_sg(sgl
, sg
, nents
, i
) {
185 BUG_ON(!sg_page(sg
));
187 sg_dma_address(sg
) = (dma_addr_t
)virt_to_phys(va
);
188 sg_dma_len(sg
) = sg
->length
;
194 EXPORT_SYMBOL(dma_map_sg
);
197 dma_set_mask(struct device
*dev
, u64 mask
)
199 if (!dev
->dma_mask
|| !dma_supported(dev
, mask
))
202 *dev
->dma_mask
= mask
;
206 EXPORT_SYMBOL(dma_set_mask
);
208 void __iomem
*pci_iomap(struct pci_dev
*dev
, int bar
, unsigned long maxlen
)
213 void pci_iounmap(struct pci_dev
*dev
, void __iomem
* addr
)
217 EXPORT_SYMBOL(pci_iomap
);
218 EXPORT_SYMBOL(pci_iounmap
);