root / hw / unin_pci.c @ 92f562ec
History | View | Annotate | Download (11.7 kB)
1 | 502a5395 | pbrook | /*
|
---|---|---|---|
2 | 502a5395 | pbrook | * QEMU Uninorth PCI host (for all Mac99 and newer machines)
|
3 | 502a5395 | pbrook | *
|
4 | 502a5395 | pbrook | * Copyright (c) 2006 Fabrice Bellard
|
5 | 5fafdf24 | ths | *
|
6 | 502a5395 | pbrook | * Permission is hereby granted, free of charge, to any person obtaining a copy
|
7 | 502a5395 | pbrook | * of this software and associated documentation files (the "Software"), to deal
|
8 | 502a5395 | pbrook | * in the Software without restriction, including without limitation the rights
|
9 | 502a5395 | pbrook | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10 | 502a5395 | pbrook | * copies of the Software, and to permit persons to whom the Software is
|
11 | 502a5395 | pbrook | * furnished to do so, subject to the following conditions:
|
12 | 502a5395 | pbrook | *
|
13 | 502a5395 | pbrook | * The above copyright notice and this permission notice shall be included in
|
14 | 502a5395 | pbrook | * all copies or substantial portions of the Software.
|
15 | 502a5395 | pbrook | *
|
16 | 502a5395 | pbrook | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17 | 502a5395 | pbrook | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18 | 502a5395 | pbrook | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
19 | 502a5395 | pbrook | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20 | 502a5395 | pbrook | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21 | 502a5395 | pbrook | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22 | 502a5395 | pbrook | * THE SOFTWARE.
|
23 | 502a5395 | pbrook | */
|
24 | 87ecb68b | pbrook | #include "hw.h" |
25 | 87ecb68b | pbrook | #include "ppc_mac.h" |
26 | 87ecb68b | pbrook | #include "pci.h" |
27 | 4f5e19e6 | Isaku Yamahata | #include "pci_host.h" |
28 | 87ecb68b | pbrook | |
29 | f3902383 | blueswir1 | /* debug UniNorth */
|
30 | f3902383 | blueswir1 | //#define DEBUG_UNIN
|
31 | f3902383 | blueswir1 | |
32 | f3902383 | blueswir1 | #ifdef DEBUG_UNIN
|
33 | 001faf32 | Blue Swirl | #define UNIN_DPRINTF(fmt, ...) \
|
34 | 001faf32 | Blue Swirl | do { printf("UNIN: " fmt , ## __VA_ARGS__); } while (0) |
35 | f3902383 | blueswir1 | #else
|
36 | 001faf32 | Blue Swirl | #define UNIN_DPRINTF(fmt, ...)
|
37 | f3902383 | blueswir1 | #endif
|
38 | f3902383 | blueswir1 | |
39 | fa0be69a | Alexander Graf | static const int unin_irq_line[] = { 0x1b, 0x1c, 0x1d, 0x1e }; |
40 | fa0be69a | Alexander Graf | |
41 | 2e29bd04 | Blue Swirl | typedef struct UNINState { |
42 | 2e29bd04 | Blue Swirl | SysBusDevice busdev; |
43 | 2e29bd04 | Blue Swirl | PCIHostState host_state; |
44 | d86f0e32 | Alexander Graf | ReadWriteHandler data_handler; |
45 | 2e29bd04 | Blue Swirl | } UNINState; |
46 | 502a5395 | pbrook | |
47 | d2b59317 | pbrook | static int pci_unin_map_irq(PCIDevice *pci_dev, int irq_num) |
48 | 502a5395 | pbrook | { |
49 | fa0be69a | Alexander Graf | int retval;
|
50 | fa0be69a | Alexander Graf | int devfn = pci_dev->devfn & 0x00FFFFFF; |
51 | fa0be69a | Alexander Graf | |
52 | fa0be69a | Alexander Graf | retval = (((devfn >> 11) & 0x1F) + irq_num) & 3; |
53 | fa0be69a | Alexander Graf | |
54 | fa0be69a | Alexander Graf | return retval;
|
55 | d2b59317 | pbrook | } |
56 | d2b59317 | pbrook | |
57 | 5d4e84c8 | Juan Quintela | static void pci_unin_set_irq(void *opaque, int irq_num, int level) |
58 | d2b59317 | pbrook | { |
59 | 5d4e84c8 | Juan Quintela | qemu_irq *pic = opaque; |
60 | 5d4e84c8 | Juan Quintela | |
61 | fa0be69a | Alexander Graf | UNIN_DPRINTF("%s: setting INT %d = %d\n", __func__,
|
62 | fa0be69a | Alexander Graf | unin_irq_line[irq_num], level); |
63 | fa0be69a | Alexander Graf | qemu_set_irq(pic[unin_irq_line[irq_num]], level); |
64 | 502a5395 | pbrook | } |
65 | 502a5395 | pbrook | |
66 | f3902383 | blueswir1 | static void pci_unin_reset(void *opaque) |
67 | f3902383 | blueswir1 | { |
68 | f3902383 | blueswir1 | } |
69 | f3902383 | blueswir1 | |
70 | d86f0e32 | Alexander Graf | static uint32_t unin_get_config_reg(uint32_t reg, uint32_t addr)
|
71 | d86f0e32 | Alexander Graf | { |
72 | d86f0e32 | Alexander Graf | uint32_t retval; |
73 | d86f0e32 | Alexander Graf | |
74 | d86f0e32 | Alexander Graf | if (reg & (1u << 31)) { |
75 | d86f0e32 | Alexander Graf | /* XXX OpenBIOS compatibility hack */
|
76 | d86f0e32 | Alexander Graf | retval = reg | (addr & 3);
|
77 | d86f0e32 | Alexander Graf | } else if (reg & 1) { |
78 | d86f0e32 | Alexander Graf | /* CFA1 style */
|
79 | d86f0e32 | Alexander Graf | retval = (reg & ~7u) | (addr & 7); |
80 | d86f0e32 | Alexander Graf | } else {
|
81 | d86f0e32 | Alexander Graf | uint32_t slot, func; |
82 | d86f0e32 | Alexander Graf | |
83 | d86f0e32 | Alexander Graf | /* Grab CFA0 style values */
|
84 | d86f0e32 | Alexander Graf | slot = ffs(reg & 0xfffff800) - 1; |
85 | d86f0e32 | Alexander Graf | func = (reg >> 8) & 7; |
86 | d86f0e32 | Alexander Graf | |
87 | d86f0e32 | Alexander Graf | /* ... and then convert them to x86 format */
|
88 | d86f0e32 | Alexander Graf | /* config pointer */
|
89 | d86f0e32 | Alexander Graf | retval = (reg & (0xff - 7)) | (addr & 7); |
90 | d86f0e32 | Alexander Graf | /* slot */
|
91 | d86f0e32 | Alexander Graf | retval |= slot << 11;
|
92 | d86f0e32 | Alexander Graf | /* fn */
|
93 | d86f0e32 | Alexander Graf | retval |= func << 8;
|
94 | d86f0e32 | Alexander Graf | } |
95 | d86f0e32 | Alexander Graf | |
96 | d86f0e32 | Alexander Graf | |
97 | d86f0e32 | Alexander Graf | UNIN_DPRINTF("Converted config space accessor %08x/%08x -> %08x\n",
|
98 | d86f0e32 | Alexander Graf | reg, addr, retval); |
99 | d86f0e32 | Alexander Graf | |
100 | d86f0e32 | Alexander Graf | return retval;
|
101 | d86f0e32 | Alexander Graf | } |
102 | d86f0e32 | Alexander Graf | |
103 | d86f0e32 | Alexander Graf | static void unin_data_write(ReadWriteHandler *handler, |
104 | d86f0e32 | Alexander Graf | pcibus_t addr, uint32_t val, int len)
|
105 | d86f0e32 | Alexander Graf | { |
106 | d86f0e32 | Alexander Graf | UNINState *s = container_of(handler, UNINState, data_handler); |
107 | d86f0e32 | Alexander Graf | UNIN_DPRINTF("write addr %" FMT_PCIBUS " len %d val %x\n", addr, len, val); |
108 | d86f0e32 | Alexander Graf | pci_data_write(s->host_state.bus, |
109 | d86f0e32 | Alexander Graf | unin_get_config_reg(s->host_state.config_reg, addr), |
110 | d86f0e32 | Alexander Graf | val, len); |
111 | d86f0e32 | Alexander Graf | } |
112 | d86f0e32 | Alexander Graf | |
113 | d86f0e32 | Alexander Graf | static uint32_t unin_data_read(ReadWriteHandler *handler,
|
114 | d86f0e32 | Alexander Graf | pcibus_t addr, int len)
|
115 | d86f0e32 | Alexander Graf | { |
116 | d86f0e32 | Alexander Graf | UNINState *s = container_of(handler, UNINState, data_handler); |
117 | d86f0e32 | Alexander Graf | uint32_t val; |
118 | d86f0e32 | Alexander Graf | |
119 | d86f0e32 | Alexander Graf | val = pci_data_read(s->host_state.bus, |
120 | d86f0e32 | Alexander Graf | unin_get_config_reg(s->host_state.config_reg, addr), |
121 | d86f0e32 | Alexander Graf | len); |
122 | d86f0e32 | Alexander Graf | UNIN_DPRINTF("read addr %" FMT_PCIBUS " len %d val %x\n", addr, len, val); |
123 | d86f0e32 | Alexander Graf | return val;
|
124 | d86f0e32 | Alexander Graf | } |
125 | d86f0e32 | Alexander Graf | |
126 | 81a322d4 | Gerd Hoffmann | static int pci_unin_main_init_device(SysBusDevice *dev) |
127 | 502a5395 | pbrook | { |
128 | 502a5395 | pbrook | UNINState *s; |
129 | 502a5395 | pbrook | int pci_mem_config, pci_mem_data;
|
130 | 502a5395 | pbrook | |
131 | 502a5395 | pbrook | /* Use values found on a real PowerMac */
|
132 | 502a5395 | pbrook | /* Uninorth main bus */
|
133 | 2e29bd04 | Blue Swirl | s = FROM_SYSBUS(UNINState, dev); |
134 | 502a5395 | pbrook | |
135 | 6ebf5905 | Alexander Graf | pci_mem_config = pci_host_conf_register_mmio(&s->host_state, |
136 | 6ebf5905 | Alexander Graf | DEVICE_LITTLE_ENDIAN); |
137 | d86f0e32 | Alexander Graf | s->data_handler.read = unin_data_read; |
138 | d86f0e32 | Alexander Graf | s->data_handler.write = unin_data_write; |
139 | 6bef0436 | Alexander Graf | pci_mem_data = cpu_register_io_memory_simple(&s->data_handler, |
140 | f23cea4d | Alexander Graf | DEVICE_LITTLE_ENDIAN); |
141 | 2e29bd04 | Blue Swirl | sysbus_init_mmio(dev, 0x1000, pci_mem_config);
|
142 | 2e29bd04 | Blue Swirl | sysbus_init_mmio(dev, 0x1000, pci_mem_data);
|
143 | 2e29bd04 | Blue Swirl | |
144 | 2e29bd04 | Blue Swirl | qemu_register_reset(pci_unin_reset, &s->host_state); |
145 | 81a322d4 | Gerd Hoffmann | return 0; |
146 | 2e29bd04 | Blue Swirl | } |
147 | 2e29bd04 | Blue Swirl | |
148 | 0f921197 | Alexander Graf | static int pci_u3_agp_init_device(SysBusDevice *dev) |
149 | 0f921197 | Alexander Graf | { |
150 | 0f921197 | Alexander Graf | UNINState *s; |
151 | 0f921197 | Alexander Graf | int pci_mem_config, pci_mem_data;
|
152 | 0f921197 | Alexander Graf | |
153 | 0f921197 | Alexander Graf | /* Uninorth U3 AGP bus */
|
154 | 0f921197 | Alexander Graf | s = FROM_SYSBUS(UNINState, dev); |
155 | 0f921197 | Alexander Graf | |
156 | 6ebf5905 | Alexander Graf | pci_mem_config = pci_host_conf_register_mmio(&s->host_state, |
157 | 6ebf5905 | Alexander Graf | DEVICE_LITTLE_ENDIAN); |
158 | 0f921197 | Alexander Graf | s->data_handler.read = unin_data_read; |
159 | 0f921197 | Alexander Graf | s->data_handler.write = unin_data_write; |
160 | 6bef0436 | Alexander Graf | pci_mem_data = cpu_register_io_memory_simple(&s->data_handler, |
161 | f23cea4d | Alexander Graf | DEVICE_LITTLE_ENDIAN); |
162 | 0f921197 | Alexander Graf | sysbus_init_mmio(dev, 0x1000, pci_mem_config);
|
163 | 0f921197 | Alexander Graf | sysbus_init_mmio(dev, 0x1000, pci_mem_data);
|
164 | 0f921197 | Alexander Graf | |
165 | 0f921197 | Alexander Graf | qemu_register_reset(pci_unin_reset, &s->host_state); |
166 | 0f921197 | Alexander Graf | |
167 | 0f921197 | Alexander Graf | return 0; |
168 | 0f921197 | Alexander Graf | } |
169 | 0f921197 | Alexander Graf | |
170 | 81a322d4 | Gerd Hoffmann | static int pci_unin_agp_init_device(SysBusDevice *dev) |
171 | 2e29bd04 | Blue Swirl | { |
172 | 2e29bd04 | Blue Swirl | UNINState *s; |
173 | 2e29bd04 | Blue Swirl | int pci_mem_config, pci_mem_data;
|
174 | 2e29bd04 | Blue Swirl | |
175 | 2e29bd04 | Blue Swirl | /* Uninorth AGP bus */
|
176 | 2e29bd04 | Blue Swirl | s = FROM_SYSBUS(UNINState, dev); |
177 | 2e29bd04 | Blue Swirl | |
178 | 6ebf5905 | Alexander Graf | pci_mem_config = pci_host_conf_register_mmio(&s->host_state, |
179 | 6ebf5905 | Alexander Graf | DEVICE_LITTLE_ENDIAN); |
180 | 6ebf5905 | Alexander Graf | pci_mem_data = pci_host_data_register_mmio(&s->host_state, |
181 | 6ebf5905 | Alexander Graf | DEVICE_LITTLE_ENDIAN); |
182 | 2e29bd04 | Blue Swirl | sysbus_init_mmio(dev, 0x1000, pci_mem_config);
|
183 | 2e29bd04 | Blue Swirl | sysbus_init_mmio(dev, 0x1000, pci_mem_data);
|
184 | 81a322d4 | Gerd Hoffmann | return 0; |
185 | 2e29bd04 | Blue Swirl | } |
186 | 2e29bd04 | Blue Swirl | |
187 | 81a322d4 | Gerd Hoffmann | static int pci_unin_internal_init_device(SysBusDevice *dev) |
188 | 2e29bd04 | Blue Swirl | { |
189 | 2e29bd04 | Blue Swirl | UNINState *s; |
190 | 2e29bd04 | Blue Swirl | int pci_mem_config, pci_mem_data;
|
191 | 2e29bd04 | Blue Swirl | |
192 | 2e29bd04 | Blue Swirl | /* Uninorth internal bus */
|
193 | 2e29bd04 | Blue Swirl | s = FROM_SYSBUS(UNINState, dev); |
194 | 2e29bd04 | Blue Swirl | |
195 | 6ebf5905 | Alexander Graf | pci_mem_config = pci_host_conf_register_mmio(&s->host_state, |
196 | 6ebf5905 | Alexander Graf | DEVICE_LITTLE_ENDIAN); |
197 | 6ebf5905 | Alexander Graf | pci_mem_data = pci_host_data_register_mmio(&s->host_state, |
198 | 6ebf5905 | Alexander Graf | DEVICE_LITTLE_ENDIAN); |
199 | 2e29bd04 | Blue Swirl | sysbus_init_mmio(dev, 0x1000, pci_mem_config);
|
200 | 2e29bd04 | Blue Swirl | sysbus_init_mmio(dev, 0x1000, pci_mem_data);
|
201 | 81a322d4 | Gerd Hoffmann | return 0; |
202 | 2e29bd04 | Blue Swirl | } |
203 | 2e29bd04 | Blue Swirl | |
204 | aee97b84 | Avi Kivity | PCIBus *pci_pmac_init(qemu_irq *pic, |
205 | aee97b84 | Avi Kivity | MemoryRegion *address_space_mem, |
206 | aee97b84 | Avi Kivity | MemoryRegion *address_space_io) |
207 | 2e29bd04 | Blue Swirl | { |
208 | 2e29bd04 | Blue Swirl | DeviceState *dev; |
209 | 2e29bd04 | Blue Swirl | SysBusDevice *s; |
210 | 2e29bd04 | Blue Swirl | UNINState *d; |
211 | 2e29bd04 | Blue Swirl | |
212 | 2e29bd04 | Blue Swirl | /* Use values found on a real PowerMac */
|
213 | 2e29bd04 | Blue Swirl | /* Uninorth main bus */
|
214 | 18dd19a7 | Markus Armbruster | dev = qdev_create(NULL, "uni-north"); |
215 | e23a1b33 | Markus Armbruster | qdev_init_nofail(dev); |
216 | 2e29bd04 | Blue Swirl | s = sysbus_from_qdev(dev); |
217 | 2e29bd04 | Blue Swirl | d = FROM_SYSBUS(UNINState, s); |
218 | cdd0935c | Blue Swirl | d->host_state.bus = pci_register_bus(&d->busdev.qdev, "pci",
|
219 | 2e29bd04 | Blue Swirl | pci_unin_set_irq, pci_unin_map_irq, |
220 | aee97b84 | Avi Kivity | pic, |
221 | aee97b84 | Avi Kivity | address_space_mem, |
222 | aee97b84 | Avi Kivity | address_space_io, |
223 | 1e39101c | Avi Kivity | PCI_DEVFN(11, 0), 4); |
224 | 2e29bd04 | Blue Swirl | |
225 | 60398748 | Blue Swirl | #if 0
|
226 | 520128bd | Isaku Yamahata | pci_create_simple(d->host_state.bus, PCI_DEVFN(11, 0), "uni-north");
|
227 | 60398748 | Blue Swirl | #endif
|
228 | 2e29bd04 | Blue Swirl | |
229 | 2e29bd04 | Blue Swirl | sysbus_mmio_map(s, 0, 0xf2800000); |
230 | 2e29bd04 | Blue Swirl | sysbus_mmio_map(s, 1, 0xf2c00000); |
231 | 2e29bd04 | Blue Swirl | |
232 | 2e29bd04 | Blue Swirl | /* DEC 21154 bridge */
|
233 | 2e29bd04 | Blue Swirl | #if 0
|
234 | 2e29bd04 | Blue Swirl | /* XXX: not activated as PPC BIOS doesn't handle multiple buses properly */
|
235 | 520128bd | Isaku Yamahata | pci_create_simple(d->host_state.bus, PCI_DEVFN(12, 0), "dec-21154");
|
236 | 2e29bd04 | Blue Swirl | #endif
|
237 | 2e29bd04 | Blue Swirl | |
238 | 2e29bd04 | Blue Swirl | /* Uninorth AGP bus */
|
239 | 520128bd | Isaku Yamahata | pci_create_simple(d->host_state.bus, PCI_DEVFN(11, 0), "uni-north-agp"); |
240 | 18dd19a7 | Markus Armbruster | dev = qdev_create(NULL, "uni-north-agp"); |
241 | d27d06f2 | Blue Swirl | qdev_init_nofail(dev); |
242 | d27d06f2 | Blue Swirl | s = sysbus_from_qdev(dev); |
243 | d27d06f2 | Blue Swirl | sysbus_mmio_map(s, 0, 0xf0800000); |
244 | d27d06f2 | Blue Swirl | sysbus_mmio_map(s, 1, 0xf0c00000); |
245 | 2e29bd04 | Blue Swirl | |
246 | 2e29bd04 | Blue Swirl | /* Uninorth internal bus */
|
247 | 2e29bd04 | Blue Swirl | #if 0
|
248 | 2e29bd04 | Blue Swirl | /* XXX: not needed for now */
|
249 | 520128bd | Isaku Yamahata | pci_create_simple(d->host_state.bus, PCI_DEVFN(14, 0), "uni-north-pci");
|
250 | 18dd19a7 | Markus Armbruster | dev = qdev_create(NULL, "uni-north-pci");
|
251 | d27d06f2 | Blue Swirl | qdev_init_nofail(dev);
|
252 | d27d06f2 | Blue Swirl | s = sysbus_from_qdev(dev);
|
253 | d27d06f2 | Blue Swirl | sysbus_mmio_map(s, 0, 0xf4800000);
|
254 | d27d06f2 | Blue Swirl | sysbus_mmio_map(s, 1, 0xf4c00000);
|
255 | 2e29bd04 | Blue Swirl | #endif
|
256 | 2e29bd04 | Blue Swirl | |
257 | 2e29bd04 | Blue Swirl | return d->host_state.bus;
|
258 | 2e29bd04 | Blue Swirl | } |
259 | 2e29bd04 | Blue Swirl | |
260 | aee97b84 | Avi Kivity | PCIBus *pci_pmac_u3_init(qemu_irq *pic, |
261 | aee97b84 | Avi Kivity | MemoryRegion *address_space_mem, |
262 | aee97b84 | Avi Kivity | MemoryRegion *address_space_io) |
263 | 0f921197 | Alexander Graf | { |
264 | 0f921197 | Alexander Graf | DeviceState *dev; |
265 | 0f921197 | Alexander Graf | SysBusDevice *s; |
266 | 0f921197 | Alexander Graf | UNINState *d; |
267 | 0f921197 | Alexander Graf | |
268 | 0f921197 | Alexander Graf | /* Uninorth AGP bus */
|
269 | 0f921197 | Alexander Graf | |
270 | 0f921197 | Alexander Graf | dev = qdev_create(NULL, "u3-agp"); |
271 | 0f921197 | Alexander Graf | qdev_init_nofail(dev); |
272 | 0f921197 | Alexander Graf | s = sysbus_from_qdev(dev); |
273 | 0f921197 | Alexander Graf | d = FROM_SYSBUS(UNINState, s); |
274 | 0f921197 | Alexander Graf | |
275 | 0f921197 | Alexander Graf | d->host_state.bus = pci_register_bus(&d->busdev.qdev, "pci",
|
276 | 0f921197 | Alexander Graf | pci_unin_set_irq, pci_unin_map_irq, |
277 | aee97b84 | Avi Kivity | pic, |
278 | aee97b84 | Avi Kivity | address_space_mem, |
279 | aee97b84 | Avi Kivity | address_space_io, |
280 | 1e39101c | Avi Kivity | PCI_DEVFN(11, 0), 4); |
281 | 0f921197 | Alexander Graf | |
282 | 0f921197 | Alexander Graf | sysbus_mmio_map(s, 0, 0xf0800000); |
283 | 0f921197 | Alexander Graf | sysbus_mmio_map(s, 1, 0xf0c00000); |
284 | 0f921197 | Alexander Graf | |
285 | 0f921197 | Alexander Graf | pci_create_simple(d->host_state.bus, 11 << 3, "u3-agp"); |
286 | 0f921197 | Alexander Graf | |
287 | 0f921197 | Alexander Graf | return d->host_state.bus;
|
288 | 0f921197 | Alexander Graf | } |
289 | 0f921197 | Alexander Graf | |
290 | 81a322d4 | Gerd Hoffmann | static int unin_main_pci_host_init(PCIDevice *d) |
291 | 2e29bd04 | Blue Swirl | { |
292 | 502a5395 | pbrook | d->config[0x0C] = 0x08; // cache_line_size |
293 | 502a5395 | pbrook | d->config[0x0D] = 0x10; // latency_timer |
294 | 502a5395 | pbrook | d->config[0x34] = 0x00; // capabilities_pointer |
295 | 81a322d4 | Gerd Hoffmann | return 0; |
296 | 2e29bd04 | Blue Swirl | } |
297 | 502a5395 | pbrook | |
298 | 81a322d4 | Gerd Hoffmann | static int unin_agp_pci_host_init(PCIDevice *d) |
299 | 2e29bd04 | Blue Swirl | { |
300 | 502a5395 | pbrook | d->config[0x0C] = 0x08; // cache_line_size |
301 | 502a5395 | pbrook | d->config[0x0D] = 0x10; // latency_timer |
302 | 502a5395 | pbrook | // d->config[0x34] = 0x80; // capabilities_pointer
|
303 | 81a322d4 | Gerd Hoffmann | return 0; |
304 | 2e29bd04 | Blue Swirl | } |
305 | 502a5395 | pbrook | |
306 | 0f921197 | Alexander Graf | static int u3_agp_pci_host_init(PCIDevice *d) |
307 | 0f921197 | Alexander Graf | { |
308 | 0f921197 | Alexander Graf | /* cache line size */
|
309 | 0f921197 | Alexander Graf | d->config[0x0C] = 0x08; |
310 | 0f921197 | Alexander Graf | /* latency timer */
|
311 | 0f921197 | Alexander Graf | d->config[0x0D] = 0x10; |
312 | 0f921197 | Alexander Graf | return 0; |
313 | 0f921197 | Alexander Graf | } |
314 | 0f921197 | Alexander Graf | |
315 | 81a322d4 | Gerd Hoffmann | static int unin_internal_pci_host_init(PCIDevice *d) |
316 | 2e29bd04 | Blue Swirl | { |
317 | 502a5395 | pbrook | d->config[0x0C] = 0x08; // cache_line_size |
318 | 502a5395 | pbrook | d->config[0x0D] = 0x10; // latency_timer |
319 | 502a5395 | pbrook | d->config[0x34] = 0x00; // capabilities_pointer |
320 | 81a322d4 | Gerd Hoffmann | return 0; |
321 | 2e29bd04 | Blue Swirl | } |
322 | 2e29bd04 | Blue Swirl | |
323 | 2e29bd04 | Blue Swirl | static PCIDeviceInfo unin_main_pci_host_info = {
|
324 | 18dd19a7 | Markus Armbruster | .qdev.name = "uni-north",
|
325 | 2e29bd04 | Blue Swirl | .qdev.size = sizeof(PCIDevice),
|
326 | 2e29bd04 | Blue Swirl | .init = unin_main_pci_host_init, |
327 | d7b61ecc | Isaku Yamahata | .vendor_id = PCI_VENDOR_ID_APPLE, |
328 | d7b61ecc | Isaku Yamahata | .device_id = PCI_DEVICE_ID_APPLE_UNI_N_PCI, |
329 | d7b61ecc | Isaku Yamahata | .revision = 0x00,
|
330 | d7b61ecc | Isaku Yamahata | .class_id = PCI_CLASS_BRIDGE_HOST, |
331 | 2e29bd04 | Blue Swirl | }; |
332 | 2e29bd04 | Blue Swirl | |
333 | 0f921197 | Alexander Graf | static PCIDeviceInfo u3_agp_pci_host_info = {
|
334 | 0f921197 | Alexander Graf | .qdev.name = "u3-agp",
|
335 | 0f921197 | Alexander Graf | .qdev.size = sizeof(PCIDevice),
|
336 | 0f921197 | Alexander Graf | .init = u3_agp_pci_host_init, |
337 | d7b61ecc | Isaku Yamahata | .vendor_id = PCI_VENDOR_ID_APPLE, |
338 | d7b61ecc | Isaku Yamahata | .device_id = PCI_DEVICE_ID_APPLE_U3_AGP, |
339 | d7b61ecc | Isaku Yamahata | .revision = 0x00,
|
340 | d7b61ecc | Isaku Yamahata | .class_id = PCI_CLASS_BRIDGE_HOST, |
341 | 0f921197 | Alexander Graf | }; |
342 | 0f921197 | Alexander Graf | |
343 | 2e29bd04 | Blue Swirl | static PCIDeviceInfo unin_agp_pci_host_info = {
|
344 | 18dd19a7 | Markus Armbruster | .qdev.name = "uni-north-agp",
|
345 | 2e29bd04 | Blue Swirl | .qdev.size = sizeof(PCIDevice),
|
346 | 2e29bd04 | Blue Swirl | .init = unin_agp_pci_host_init, |
347 | d7b61ecc | Isaku Yamahata | .vendor_id = PCI_VENDOR_ID_APPLE, |
348 | d7b61ecc | Isaku Yamahata | .device_id = PCI_DEVICE_ID_APPLE_UNI_N_AGP, |
349 | d7b61ecc | Isaku Yamahata | .revision = 0x00,
|
350 | d7b61ecc | Isaku Yamahata | .class_id = PCI_CLASS_BRIDGE_HOST, |
351 | 2e29bd04 | Blue Swirl | }; |
352 | 2e29bd04 | Blue Swirl | |
353 | 2e29bd04 | Blue Swirl | static PCIDeviceInfo unin_internal_pci_host_info = {
|
354 | 18dd19a7 | Markus Armbruster | .qdev.name = "uni-north-pci",
|
355 | 2e29bd04 | Blue Swirl | .qdev.size = sizeof(PCIDevice),
|
356 | 2e29bd04 | Blue Swirl | .init = unin_internal_pci_host_init, |
357 | d7b61ecc | Isaku Yamahata | .vendor_id = PCI_VENDOR_ID_APPLE, |
358 | d7b61ecc | Isaku Yamahata | .device_id = PCI_DEVICE_ID_APPLE_UNI_N_I_PCI, |
359 | d7b61ecc | Isaku Yamahata | .revision = 0x00,
|
360 | d7b61ecc | Isaku Yamahata | .class_id = PCI_CLASS_BRIDGE_HOST, |
361 | 2e29bd04 | Blue Swirl | }; |
362 | 2e29bd04 | Blue Swirl | |
363 | 2e29bd04 | Blue Swirl | static void unin_register_devices(void) |
364 | 2e29bd04 | Blue Swirl | { |
365 | 18dd19a7 | Markus Armbruster | sysbus_register_dev("uni-north", sizeof(UNINState), |
366 | 2e29bd04 | Blue Swirl | pci_unin_main_init_device); |
367 | 2e29bd04 | Blue Swirl | pci_qdev_register(&unin_main_pci_host_info); |
368 | 0f921197 | Alexander Graf | sysbus_register_dev("u3-agp", sizeof(UNINState), |
369 | 0f921197 | Alexander Graf | pci_u3_agp_init_device); |
370 | 0f921197 | Alexander Graf | pci_qdev_register(&u3_agp_pci_host_info); |
371 | 18dd19a7 | Markus Armbruster | sysbus_register_dev("uni-north-agp", sizeof(UNINState), |
372 | 2e29bd04 | Blue Swirl | pci_unin_agp_init_device); |
373 | 2e29bd04 | Blue Swirl | pci_qdev_register(&unin_agp_pci_host_info); |
374 | 18dd19a7 | Markus Armbruster | sysbus_register_dev("uni-north-pci", sizeof(UNINState), |
375 | 2e29bd04 | Blue Swirl | pci_unin_internal_init_device); |
376 | 2e29bd04 | Blue Swirl | pci_qdev_register(&unin_internal_pci_host_info); |
377 | 502a5395 | pbrook | } |
378 | 2e29bd04 | Blue Swirl | |
379 | 2e29bd04 | Blue Swirl | device_init(unin_register_devices) |