1 // SPDX-License-Identifier: GPL-2.0
3 * linux/arch/alpha/kernel/pci-noop.c
5 * Stub PCI interfaces for Jensen-specific kernels.
9 #include <linux/init.h>
10 #include <linux/bootmem.h>
11 #include <linux/gfp.h>
12 #include <linux/capability.h>
14 #include <linux/errno.h>
15 #include <linux/sched.h>
16 #include <linux/dma-mapping.h>
17 #include <linux/scatterlist.h>
23 * The PCI controller list.
26 struct pci_controller
*hose_head
, **hose_tail
= &hose_head
;
27 struct pci_controller
*pci_isa_hose
;
30 struct pci_controller
* __init
31 alloc_pci_controller(void)
33 struct pci_controller
*hose
;
35 hose
= alloc_bootmem(sizeof(*hose
));
38 hose_tail
= &hose
->next
;
43 struct resource
* __init
46 return alloc_bootmem(sizeof(struct resource
));
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 static void *alpha_noop_alloc_coherent(struct device
*dev
, size_t size
,
108 dma_addr_t
*dma_handle
, gfp_t gfp
,
113 if (!dev
|| *dev
->dma_mask
>= 0xffffffffUL
)
115 ret
= (void *)__get_free_pages(gfp
, get_order(size
));
117 memset(ret
, 0, size
);
118 *dma_handle
= virt_to_phys(ret
);
123 static int alpha_noop_supported(struct device
*dev
, u64 mask
)
125 return mask
< 0x00ffffffUL
? 0 : 1;
128 const struct dma_map_ops alpha_noop_ops
= {
129 .alloc
= alpha_noop_alloc_coherent
,
130 .free
= dma_noop_free_coherent
,
131 .map_page
= dma_noop_map_page
,
132 .map_sg
= dma_noop_map_sg
,
133 .mapping_error
= dma_noop_mapping_error
,
134 .dma_supported
= alpha_noop_supported
,
137 const struct dma_map_ops
*dma_ops
= &alpha_noop_ops
;
138 EXPORT_SYMBOL(dma_ops
);