1
2
3
4
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
18
19
20struct pci_controller *hose_head, **hose_tail = &hose_head;
21struct pci_controller *pci_isa_hose;
22
23
24struct pci_controller * __init
25alloc_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
37struct resource * __init
38alloc_resource(void)
39{
40 struct resource *res;
41
42 res = alloc_bootmem(sizeof(*res));
43
44 return res;
45}
46
47asmlinkage long
48sys_pciconfig_iobase(long which, unsigned long bus, unsigned long dfn)
49{
50 struct pci_controller *hose;
51 struct pci_dev *dev;
52
53
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
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
86asmlinkage long
87sys_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
96asmlinkage long
97sys_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
106void *
107pci_alloc_consistent(struct pci_dev *pdev, size_t size, dma_addr_t *dma_addrp)
108{
109 return (void *)0;
110}
111void
112pci_free_consistent(struct pci_dev *pdev, size_t size, void *cpu_addr,
113 dma_addr_t dma_addr)
114{
115}
116dma_addr_t
117pci_map_single(struct pci_dev *pdev, void *cpu_addr, size_t size,
118 int direction)
119{
120 return (dma_addr_t)0;
121}
122void
123pci_unmap_single(struct pci_dev *pdev, dma_addr_t dma_addr, size_t size,
124 int direction)
125{
126}
127int
128pci_map_sg(struct pci_dev *pdev, struct scatterlist *sg, int nents,
129 int direction)
130{
131 return 0;
132}
133void
134pci_unmap_sg(struct pci_dev *pdev, struct scatterlist *sg, int nents,
135 int direction)
136{
137}
138int
139pci_dma_supported(struct pci_dev *hwdev, dma_addr_t mask)
140{
141 return 0;
142}
143