File: /usr/src/linux/arch/alpha/kernel/pci-noop.c
1 /*
2 * linux/arch/alpha/kernel/pci-noop.c
3 *
4 * Stub PCI interfaces for Jensen-specific kernels.
5 */
6
7 #include <linux/pci.h>
8 #include <linux/init.h>
9 #include <linux/bootmem.h>
10 #include <linux/errno.h>
11 #include <linux/sched.h>
12
13 #include "proto.h"
14
15
16 /*
17 * The PCI controller list.
18 */
19
20 struct pci_controller *hose_head, **hose_tail = &hose_head;
21 struct pci_controller *pci_isa_hose;
22
23
24 struct pci_controller * __init
25 alloc_pci_controller(void)
26 {
27 struct pci_controller *hose;
28
29 hose = alloc_bootmem(sizeof(*hose));
30
31 *hose_tail = hose;
32 hose_tail = &hose->next;
33
34 return hose;
35 }
36
37 struct resource * __init
38 alloc_resource(void)
39 {
40 struct resource *res;
41
42 res = alloc_bootmem(sizeof(*res));
43
44 return res;
45 }
46
47 asmlinkage long
48 sys_pciconfig_iobase(long which, unsigned long bus, unsigned long dfn)
49 {
50 struct pci_controller *hose;
51 struct pci_dev *dev;
52
53 /* from hose or from bus.devfn */
54 if (which & IOBASE_FROM_HOSE) {
55 for (hose = hose_head; hose; hose = hose->next)
56 if (hose->index == bus)
57 break;
58 if (!hose)
59 return -ENODEV;
60 } else {
61 /* Special hook for ISA access. */
62 if (bus == 0 && dfn == 0)
63 hose = pci_isa_hose;
64 else
65 return -ENODEV;
66 }
67
68 switch (which & ~IOBASE_FROM_HOSE) {
69 case IOBASE_HOSE:
70 return hose->index;
71 case IOBASE_SPARSE_MEM:
72 return hose->sparse_mem_base;
73 case IOBASE_DENSE_MEM:
74 return hose->dense_mem_base;
75 case IOBASE_SPARSE_IO:
76 return hose->sparse_io_base;
77 case IOBASE_DENSE_IO:
78 return hose->dense_io_base;
79 case IOBASE_ROOT_BUS:
80 return hose->bus->number;
81 }
82
83 return -EOPNOTSUPP;
84 }
85
86 asmlinkage long
87 sys_pciconfig_read(unsigned long bus, unsigned long dfn,
88 unsigned long off, unsigned long len, void *buf)
89 {
90 if (!capable(CAP_SYS_ADMIN))
91 return -EPERM;
92 else
93 return -ENODEV;
94 }
95
96 asmlinkage long
97 sys_pciconfig_write(unsigned long bus, unsigned long dfn,
98 unsigned long off, unsigned long len, void *buf)
99 {
100 if (!capable(CAP_SYS_ADMIN))
101 return -EPERM;
102 else
103 return -ENODEV;
104 }
105 /* stubs for the routines in pci_iommu.c */
106 void *
107 pci_alloc_consistent(struct pci_dev *pdev, long size, dma_addr_t *dma_addrp)
108 {
109 }
110 void
111 pci_free_consistent(struct pci_dev *pdev, long size, void *cpu_addr,
112 dma_addr_t dma_addr)
113 {
114 }
115 dma_addr_t
116 pci_map_single(struct pci_dev *pdev, void *cpu_addr, long size,
117 int direction)
118 {
119 }
120 void
121 pci_unmap_single(struct pci_dev *pdev, dma_addr_t dma_addr, long size,
122 int direction)
123 {
124 }
125 int
126 pci_map_sg(struct pci_dev *pdev, struct scatterlist *sg, int nents,
127 int direction)
128 {
129 }
130 void
131 pci_unmap_sg(struct pci_dev *pdev, struct scatterlist *sg, int nents,
132 int direction)
133 {
134 }
135 int
136 pci_dma_supported(struct pci_dev *hwdev, dma_addr_t mask)
137 {
138 return 0;
139 }
140