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>
20 * The PCI controller list.
23 struct pci_controller
*hose_head
, **hose_tail
= &hose_head
;
24 struct pci_controller
*pci_isa_hose
;
27 struct pci_controller
* __init
28 alloc_pci_controller(void)
30 struct pci_controller
*hose
;
32 hose
= alloc_bootmem(sizeof(*hose
));
35 hose_tail
= &hose
->next
;
40 struct resource
* __init
45 res
= alloc_bootmem(sizeof(*res
));
51 sys_pciconfig_iobase(long which
, unsigned long bus
, unsigned long dfn
)
53 struct pci_controller
*hose
;
55 /* from hose or from bus.devfn */
56 if (which
& IOBASE_FROM_HOSE
) {
57 for (hose
= hose_head
; hose
; hose
= hose
->next
)
58 if (hose
->index
== bus
)
63 /* Special hook for ISA access. */
64 if (bus
== 0 && dfn
== 0)
70 switch (which
& ~IOBASE_FROM_HOSE
) {
73 case IOBASE_SPARSE_MEM
:
74 return hose
->sparse_mem_base
;
75 case IOBASE_DENSE_MEM
:
76 return hose
->dense_mem_base
;
77 case IOBASE_SPARSE_IO
:
78 return hose
->sparse_io_base
;
80 return hose
->dense_io_base
;
82 return hose
->bus
->number
;
89 sys_pciconfig_read(unsigned long bus
, unsigned long dfn
,
90 unsigned long off
, unsigned long len
, void *buf
)
92 if (!capable(CAP_SYS_ADMIN
))
99 sys_pciconfig_write(unsigned long bus
, unsigned long dfn
,
100 unsigned long off
, unsigned long len
, void *buf
)
102 if (!capable(CAP_SYS_ADMIN
))
108 /* Stubs for the routines in pci_iommu.c: */
111 pci_alloc_consistent(struct pci_dev
*pdev
, size_t size
, dma_addr_t
*dma_addrp
)
117 pci_free_consistent(struct pci_dev
*pdev
, size_t size
, void *cpu_addr
,
123 pci_map_single(struct pci_dev
*pdev
, void *cpu_addr
, size_t size
,
126 return (dma_addr_t
) 0;
130 pci_unmap_single(struct pci_dev
*pdev
, dma_addr_t dma_addr
, size_t size
,
136 pci_map_sg(struct pci_dev
*pdev
, struct scatterlist
*sg
, int nents
,
143 pci_unmap_sg(struct pci_dev
*pdev
, struct scatterlist
*sg
, int nents
,
149 pci_dma_supported(struct pci_dev
*hwdev
, dma_addr_t mask
)
154 /* Generic DMA mapping functions: */
157 dma_alloc_coherent(struct device
*dev
, size_t size
,
158 dma_addr_t
*dma_handle
, gfp_t gfp
)
162 if (!dev
|| *dev
->dma_mask
>= 0xffffffffUL
)
164 ret
= (void *)__get_free_pages(gfp
, get_order(size
));
166 memset(ret
, 0, size
);
167 *dma_handle
= virt_to_bus(ret
);
172 EXPORT_SYMBOL(dma_alloc_coherent
);
175 dma_map_sg(struct device
*dev
, struct scatterlist
*sg
, int nents
,
176 enum dma_data_direction direction
)
180 for (i
= 0; i
< nents
; i
++ ) {
184 va
= page_address(sg
[i
].page
) + sg
[i
].offset
;
185 sg_dma_address(sg
+ i
) = (dma_addr_t
)virt_to_bus(va
);
186 sg_dma_len(sg
+ i
) = sg
[i
].length
;
192 EXPORT_SYMBOL(dma_map_sg
);
195 dma_set_mask(struct device
*dev
, u64 mask
)
197 if (!dev
->dma_mask
|| !dma_supported(dev
, mask
))
200 *dev
->dma_mask
= mask
;
205 void __iomem
*pci_iomap(struct pci_dev
*dev
, int bar
, unsigned long maxlen
)
210 void pci_iounmap(struct pci_dev
*dev
, void __iomem
* addr
)
214 EXPORT_SYMBOL(pci_iomap
);
215 EXPORT_SYMBOL(pci_iounmap
);