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>
11 #include <linux/errno.h>
12 #include <linux/sched.h>
13 #include <linux/dma-mapping.h>
19 * The PCI controller list.
22 struct pci_controller
*hose_head
, **hose_tail
= &hose_head
;
23 struct pci_controller
*pci_isa_hose
;
26 struct pci_controller
* __init
27 alloc_pci_controller(void)
29 struct pci_controller
*hose
;
31 hose
= alloc_bootmem(sizeof(*hose
));
34 hose_tail
= &hose
->next
;
39 struct resource
* __init
44 res
= alloc_bootmem(sizeof(*res
));
50 sys_pciconfig_iobase(long which
, unsigned long bus
, unsigned long dfn
)
52 struct pci_controller
*hose
;
54 /* from hose or from bus.devfn */
55 if (which
& IOBASE_FROM_HOSE
) {
56 for (hose
= hose_head
; hose
; hose
= hose
->next
)
57 if (hose
->index
== bus
)
62 /* Special hook for ISA access. */
63 if (bus
== 0 && dfn
== 0)
69 switch (which
& ~IOBASE_FROM_HOSE
) {
72 case IOBASE_SPARSE_MEM
:
73 return hose
->sparse_mem_base
;
74 case IOBASE_DENSE_MEM
:
75 return hose
->dense_mem_base
;
76 case IOBASE_SPARSE_IO
:
77 return hose
->sparse_io_base
;
79 return hose
->dense_io_base
;
81 return hose
->bus
->number
;
88 sys_pciconfig_read(unsigned long bus
, unsigned long dfn
,
89 unsigned long off
, unsigned long len
, void *buf
)
91 if (!capable(CAP_SYS_ADMIN
))
98 sys_pciconfig_write(unsigned long bus
, unsigned long dfn
,
99 unsigned long off
, unsigned long len
, void *buf
)
101 if (!capable(CAP_SYS_ADMIN
))
107 /* Stubs for the routines in pci_iommu.c: */
110 pci_alloc_consistent(struct pci_dev
*pdev
, size_t size
, dma_addr_t
*dma_addrp
)
116 pci_free_consistent(struct pci_dev
*pdev
, size_t size
, void *cpu_addr
,
122 pci_map_single(struct pci_dev
*pdev
, void *cpu_addr
, size_t size
,
125 return (dma_addr_t
) 0;
129 pci_unmap_single(struct pci_dev
*pdev
, dma_addr_t dma_addr
, size_t size
,
135 pci_map_sg(struct pci_dev
*pdev
, struct scatterlist
*sg
, int nents
,
142 pci_unmap_sg(struct pci_dev
*pdev
, struct scatterlist
*sg
, int nents
,
148 pci_dma_supported(struct pci_dev
*hwdev
, dma_addr_t mask
)
153 /* Generic DMA mapping functions: */
156 dma_alloc_coherent(struct device
*dev
, size_t size
,
157 dma_addr_t
*dma_handle
, int gfp
)
161 if (!dev
|| *dev
->dma_mask
>= 0xffffffffUL
)
163 ret
= (void *)__get_free_pages(gfp
, get_order(size
));
165 memset(ret
, 0, size
);
166 *dma_handle
= virt_to_bus(ret
);
171 EXPORT_SYMBOL(dma_alloc_coherent
);
174 dma_map_sg(struct device
*dev
, struct scatterlist
*sg
, int nents
,
175 enum dma_data_direction direction
)
179 for (i
= 0; i
< nents
; i
++ ) {
183 va
= page_address(sg
[i
].page
) + sg
[i
].offset
;
184 sg_dma_address(sg
+ i
) = (dma_addr_t
)virt_to_bus(va
);
185 sg_dma_len(sg
+ i
) = sg
[i
].length
;
191 EXPORT_SYMBOL(dma_map_sg
);
194 dma_set_mask(struct device
*dev
, u64 mask
)
196 if (!dev
->dma_mask
|| !dma_supported(dev
, mask
))
199 *dev
->dma_mask
= mask
;
204 void __iomem
*pci_iomap(struct pci_dev
*dev
, int bar
, unsigned long maxlen
)
209 void pci_iounmap(struct pci_dev
*dev
, void __iomem
* addr
)
213 EXPORT_SYMBOL(pci_iomap
);
214 EXPORT_SYMBOL(pci_iounmap
);