Statistics
| Branch: | Revision:

root / hw / unin_pci.c @ 5b7f5327

History | View | Annotate | Download (12.1 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 87ecb68b pbrook
28 f3902383 blueswir1
/* debug UniNorth */
29 f3902383 blueswir1
//#define DEBUG_UNIN
30 f3902383 blueswir1
31 f3902383 blueswir1
#ifdef DEBUG_UNIN
32 001faf32 Blue Swirl
#define UNIN_DPRINTF(fmt, ...)                                  \
33 001faf32 Blue Swirl
    do { printf("UNIN: " fmt , ## __VA_ARGS__); } while (0)
34 f3902383 blueswir1
#else
35 001faf32 Blue Swirl
#define UNIN_DPRINTF(fmt, ...)
36 f3902383 blueswir1
#endif
37 f3902383 blueswir1
38 c227f099 Anthony Liguori
typedef target_phys_addr_t pci_addr_t;
39 502a5395 pbrook
#include "pci_host.h"
40 502a5395 pbrook
41 2e29bd04 Blue Swirl
typedef struct UNINState {
42 2e29bd04 Blue Swirl
    SysBusDevice busdev;
43 2e29bd04 Blue Swirl
    PCIHostState host_state;
44 2e29bd04 Blue Swirl
} UNINState;
45 502a5395 pbrook
46 c227f099 Anthony Liguori
static void pci_unin_main_config_writel (void *opaque, target_phys_addr_t addr,
47 502a5395 pbrook
                                         uint32_t val)
48 502a5395 pbrook
{
49 502a5395 pbrook
    UNINState *s = opaque;
50 502a5395 pbrook
51 f3902383 blueswir1
    UNIN_DPRINTF("config_writel addr " TARGET_FMT_plx " val %x\n", addr, val);
52 502a5395 pbrook
#ifdef TARGET_WORDS_BIGENDIAN
53 502a5395 pbrook
    val = bswap32(val);
54 502a5395 pbrook
#endif
55 502a5395 pbrook
56 2e29bd04 Blue Swirl
    s->host_state.config_reg = val;
57 502a5395 pbrook
}
58 502a5395 pbrook
59 502a5395 pbrook
static uint32_t pci_unin_main_config_readl (void *opaque,
60 c227f099 Anthony Liguori
                                            target_phys_addr_t addr)
61 502a5395 pbrook
{
62 502a5395 pbrook
    UNINState *s = opaque;
63 502a5395 pbrook
    uint32_t val;
64 502a5395 pbrook
65 2e29bd04 Blue Swirl
    val = s->host_state.config_reg;
66 502a5395 pbrook
#ifdef TARGET_WORDS_BIGENDIAN
67 502a5395 pbrook
    val = bswap32(val);
68 502a5395 pbrook
#endif
69 f3902383 blueswir1
    UNIN_DPRINTF("config_readl addr " TARGET_FMT_plx " val %x\n", addr, val);
70 502a5395 pbrook
71 502a5395 pbrook
    return val;
72 502a5395 pbrook
}
73 502a5395 pbrook
74 d60efc6b Blue Swirl
static CPUWriteMemoryFunc * const pci_unin_main_config_write[] = {
75 502a5395 pbrook
    &pci_unin_main_config_writel,
76 502a5395 pbrook
    &pci_unin_main_config_writel,
77 502a5395 pbrook
    &pci_unin_main_config_writel,
78 502a5395 pbrook
};
79 502a5395 pbrook
80 d60efc6b Blue Swirl
static CPUReadMemoryFunc * const pci_unin_main_config_read[] = {
81 502a5395 pbrook
    &pci_unin_main_config_readl,
82 502a5395 pbrook
    &pci_unin_main_config_readl,
83 502a5395 pbrook
    &pci_unin_main_config_readl,
84 502a5395 pbrook
};
85 502a5395 pbrook
86 d60efc6b Blue Swirl
static CPUWriteMemoryFunc * const pci_unin_main_write[] = {
87 502a5395 pbrook
    &pci_host_data_writeb,
88 502a5395 pbrook
    &pci_host_data_writew,
89 502a5395 pbrook
    &pci_host_data_writel,
90 502a5395 pbrook
};
91 502a5395 pbrook
92 d60efc6b Blue Swirl
static CPUReadMemoryFunc * const pci_unin_main_read[] = {
93 502a5395 pbrook
    &pci_host_data_readb,
94 502a5395 pbrook
    &pci_host_data_readw,
95 502a5395 pbrook
    &pci_host_data_readl,
96 502a5395 pbrook
};
97 502a5395 pbrook
98 c227f099 Anthony Liguori
static void pci_unin_config_writel (void *opaque, target_phys_addr_t addr,
99 502a5395 pbrook
                                    uint32_t val)
100 502a5395 pbrook
{
101 502a5395 pbrook
    UNINState *s = opaque;
102 502a5395 pbrook
103 2e29bd04 Blue Swirl
    s->host_state.config_reg = val;
104 502a5395 pbrook
}
105 502a5395 pbrook
106 502a5395 pbrook
static uint32_t pci_unin_config_readl (void *opaque,
107 c227f099 Anthony Liguori
                                       target_phys_addr_t addr)
108 502a5395 pbrook
{
109 502a5395 pbrook
    UNINState *s = opaque;
110 502a5395 pbrook
111 2e29bd04 Blue Swirl
    return s->host_state.config_reg;
112 502a5395 pbrook
}
113 502a5395 pbrook
114 d60efc6b Blue Swirl
static CPUWriteMemoryFunc * const pci_unin_config_write[] = {
115 502a5395 pbrook
    &pci_unin_config_writel,
116 502a5395 pbrook
    &pci_unin_config_writel,
117 502a5395 pbrook
    &pci_unin_config_writel,
118 502a5395 pbrook
};
119 502a5395 pbrook
120 d60efc6b Blue Swirl
static CPUReadMemoryFunc * const pci_unin_config_read[] = {
121 502a5395 pbrook
    &pci_unin_config_readl,
122 502a5395 pbrook
    &pci_unin_config_readl,
123 502a5395 pbrook
    &pci_unin_config_readl,
124 502a5395 pbrook
};
125 502a5395 pbrook
126 d60efc6b Blue Swirl
static CPUWriteMemoryFunc * const pci_unin_write[] = {
127 2e29bd04 Blue Swirl
    &pci_host_data_writeb,
128 2e29bd04 Blue Swirl
    &pci_host_data_writew,
129 2e29bd04 Blue Swirl
    &pci_host_data_writel,
130 502a5395 pbrook
};
131 502a5395 pbrook
132 d60efc6b Blue Swirl
static CPUReadMemoryFunc * const pci_unin_read[] = {
133 2e29bd04 Blue Swirl
    &pci_host_data_readb,
134 2e29bd04 Blue Swirl
    &pci_host_data_readw,
135 2e29bd04 Blue Swirl
    &pci_host_data_readl,
136 502a5395 pbrook
};
137 502a5395 pbrook
138 d2b59317 pbrook
/* Don't know if this matches real hardware, but it agrees with OHW.  */
139 d2b59317 pbrook
static int pci_unin_map_irq(PCIDevice *pci_dev, int irq_num)
140 502a5395 pbrook
{
141 d2b59317 pbrook
    return (irq_num + (pci_dev->devfn >> 3)) & 3;
142 d2b59317 pbrook
}
143 d2b59317 pbrook
144 5d4e84c8 Juan Quintela
static void pci_unin_set_irq(void *opaque, int irq_num, int level)
145 d2b59317 pbrook
{
146 5d4e84c8 Juan Quintela
    qemu_irq *pic = opaque;
147 5d4e84c8 Juan Quintela
148 d537cf6c pbrook
    qemu_set_irq(pic[irq_num + 8], level);
149 502a5395 pbrook
}
150 502a5395 pbrook
151 f3902383 blueswir1
static void pci_unin_save(QEMUFile* f, void *opaque)
152 f3902383 blueswir1
{
153 f3902383 blueswir1
    PCIDevice *d = opaque;
154 f3902383 blueswir1
155 f3902383 blueswir1
    pci_device_save(d, f);
156 f3902383 blueswir1
}
157 f3902383 blueswir1
158 f3902383 blueswir1
static int pci_unin_load(QEMUFile* f, void *opaque, int version_id)
159 f3902383 blueswir1
{
160 f3902383 blueswir1
    PCIDevice *d = opaque;
161 f3902383 blueswir1
162 f3902383 blueswir1
    if (version_id != 1)
163 f3902383 blueswir1
        return -EINVAL;
164 f3902383 blueswir1
165 f3902383 blueswir1
    return pci_device_load(d, f);
166 f3902383 blueswir1
}
167 f3902383 blueswir1
168 f3902383 blueswir1
static void pci_unin_reset(void *opaque)
169 f3902383 blueswir1
{
170 f3902383 blueswir1
}
171 f3902383 blueswir1
172 81a322d4 Gerd Hoffmann
static int pci_unin_main_init_device(SysBusDevice *dev)
173 502a5395 pbrook
{
174 502a5395 pbrook
    UNINState *s;
175 502a5395 pbrook
    int pci_mem_config, pci_mem_data;
176 502a5395 pbrook
177 502a5395 pbrook
    /* Use values found on a real PowerMac */
178 502a5395 pbrook
    /* Uninorth main bus */
179 2e29bd04 Blue Swirl
    s = FROM_SYSBUS(UNINState, dev);
180 502a5395 pbrook
181 1eed09cb Avi Kivity
    pci_mem_config = cpu_register_io_memory(pci_unin_main_config_read,
182 502a5395 pbrook
                                            pci_unin_main_config_write, s);
183 1eed09cb Avi Kivity
    pci_mem_data = cpu_register_io_memory(pci_unin_main_read,
184 2e29bd04 Blue Swirl
                                          pci_unin_main_write, &s->host_state);
185 2e29bd04 Blue Swirl
186 2e29bd04 Blue Swirl
    sysbus_init_mmio(dev, 0x1000, pci_mem_config);
187 2e29bd04 Blue Swirl
    sysbus_init_mmio(dev, 0x1000, pci_mem_data);
188 2e29bd04 Blue Swirl
189 2e29bd04 Blue Swirl
    register_savevm("uninorth", 0, 1, pci_unin_save, pci_unin_load, &s->host_state);
190 2e29bd04 Blue Swirl
    qemu_register_reset(pci_unin_reset, &s->host_state);
191 2e29bd04 Blue Swirl
    pci_unin_reset(&s->host_state);
192 81a322d4 Gerd Hoffmann
    return 0;
193 2e29bd04 Blue Swirl
}
194 2e29bd04 Blue Swirl
195 81a322d4 Gerd Hoffmann
static int pci_dec_21154_init_device(SysBusDevice *dev)
196 2e29bd04 Blue Swirl
{
197 2e29bd04 Blue Swirl
    UNINState *s;
198 2e29bd04 Blue Swirl
    int pci_mem_config, pci_mem_data;
199 2e29bd04 Blue Swirl
200 2e29bd04 Blue Swirl
    /* Uninorth bridge */
201 2e29bd04 Blue Swirl
    s = FROM_SYSBUS(UNINState, dev);
202 2e29bd04 Blue Swirl
203 2e29bd04 Blue Swirl
    // XXX: s = &pci_bridge[2];
204 2e29bd04 Blue Swirl
    pci_mem_config = cpu_register_io_memory(pci_unin_config_read,
205 2e29bd04 Blue Swirl
                                            pci_unin_config_write, s);
206 2e29bd04 Blue Swirl
    pci_mem_data = cpu_register_io_memory(pci_unin_main_read,
207 2e29bd04 Blue Swirl
                                          pci_unin_main_write, &s->host_state);
208 2e29bd04 Blue Swirl
    sysbus_init_mmio(dev, 0x1000, pci_mem_config);
209 2e29bd04 Blue Swirl
    sysbus_init_mmio(dev, 0x1000, pci_mem_data);
210 81a322d4 Gerd Hoffmann
    return 0;
211 2e29bd04 Blue Swirl
}
212 2e29bd04 Blue Swirl
213 81a322d4 Gerd Hoffmann
static int pci_unin_agp_init_device(SysBusDevice *dev)
214 2e29bd04 Blue Swirl
{
215 2e29bd04 Blue Swirl
    UNINState *s;
216 2e29bd04 Blue Swirl
    int pci_mem_config, pci_mem_data;
217 2e29bd04 Blue Swirl
218 2e29bd04 Blue Swirl
    /* Uninorth AGP bus */
219 2e29bd04 Blue Swirl
    s = FROM_SYSBUS(UNINState, dev);
220 2e29bd04 Blue Swirl
221 2e29bd04 Blue Swirl
    pci_mem_config = cpu_register_io_memory(pci_unin_config_read,
222 2e29bd04 Blue Swirl
                                            pci_unin_config_write, s);
223 2e29bd04 Blue Swirl
    pci_mem_data = cpu_register_io_memory(pci_unin_main_read,
224 2e29bd04 Blue Swirl
                                          pci_unin_main_write, &s->host_state);
225 2e29bd04 Blue Swirl
    sysbus_init_mmio(dev, 0x1000, pci_mem_config);
226 2e29bd04 Blue Swirl
    sysbus_init_mmio(dev, 0x1000, pci_mem_data);
227 81a322d4 Gerd Hoffmann
    return 0;
228 2e29bd04 Blue Swirl
}
229 2e29bd04 Blue Swirl
230 81a322d4 Gerd Hoffmann
static int pci_unin_internal_init_device(SysBusDevice *dev)
231 2e29bd04 Blue Swirl
{
232 2e29bd04 Blue Swirl
    UNINState *s;
233 2e29bd04 Blue Swirl
    int pci_mem_config, pci_mem_data;
234 2e29bd04 Blue Swirl
235 2e29bd04 Blue Swirl
    /* Uninorth internal bus */
236 2e29bd04 Blue Swirl
    s = FROM_SYSBUS(UNINState, dev);
237 2e29bd04 Blue Swirl
238 2e29bd04 Blue Swirl
    pci_mem_config = cpu_register_io_memory(pci_unin_config_read,
239 2e29bd04 Blue Swirl
                                            pci_unin_config_write, s);
240 2e29bd04 Blue Swirl
    pci_mem_data = cpu_register_io_memory(pci_unin_read,
241 2e29bd04 Blue Swirl
                                          pci_unin_write, s);
242 2e29bd04 Blue Swirl
    sysbus_init_mmio(dev, 0x1000, pci_mem_config);
243 2e29bd04 Blue Swirl
    sysbus_init_mmio(dev, 0x1000, pci_mem_data);
244 81a322d4 Gerd Hoffmann
    return 0;
245 2e29bd04 Blue Swirl
}
246 2e29bd04 Blue Swirl
247 2e29bd04 Blue Swirl
PCIBus *pci_pmac_init(qemu_irq *pic)
248 2e29bd04 Blue Swirl
{
249 2e29bd04 Blue Swirl
    DeviceState *dev;
250 2e29bd04 Blue Swirl
    SysBusDevice *s;
251 2e29bd04 Blue Swirl
    UNINState *d;
252 2e29bd04 Blue Swirl
253 2e29bd04 Blue Swirl
    /* Use values found on a real PowerMac */
254 2e29bd04 Blue Swirl
    /* Uninorth main bus */
255 2e29bd04 Blue Swirl
    dev = qdev_create(NULL, "Uni-north main");
256 2e29bd04 Blue Swirl
    qdev_init(dev);
257 2e29bd04 Blue Swirl
    s = sysbus_from_qdev(dev);
258 2e29bd04 Blue Swirl
    d = FROM_SYSBUS(UNINState, s);
259 cdd0935c Blue Swirl
    d->host_state.bus = pci_register_bus(&d->busdev.qdev, "pci",
260 2e29bd04 Blue Swirl
                                         pci_unin_set_irq, pci_unin_map_irq,
261 2e29bd04 Blue Swirl
                                         pic, 11 << 3, 4);
262 2e29bd04 Blue Swirl
263 2e29bd04 Blue Swirl
    pci_create_simple(d->host_state.bus, 11 << 3, "Uni-north main");
264 2e29bd04 Blue Swirl
265 2e29bd04 Blue Swirl
    sysbus_mmio_map(s, 0, 0xf2800000);
266 2e29bd04 Blue Swirl
    sysbus_mmio_map(s, 1, 0xf2c00000);
267 2e29bd04 Blue Swirl
268 2e29bd04 Blue Swirl
    /* DEC 21154 bridge */
269 2e29bd04 Blue Swirl
#if 0
270 2e29bd04 Blue Swirl
    /* XXX: not activated as PPC BIOS doesn't handle multiple buses properly */
271 2e29bd04 Blue Swirl
    pci_create_simple(d->host_state.bus, 12 << 3, "DEC 21154");
272 2e29bd04 Blue Swirl
#endif
273 2e29bd04 Blue Swirl
274 2e29bd04 Blue Swirl
    /* Uninorth AGP bus */
275 2e29bd04 Blue Swirl
    pci_create_simple(d->host_state.bus, 13 << 3, "Uni-north AGP");
276 2e29bd04 Blue Swirl
277 2e29bd04 Blue Swirl
    /* Uninorth internal bus */
278 2e29bd04 Blue Swirl
#if 0
279 2e29bd04 Blue Swirl
    /* XXX: not needed for now */
280 2e29bd04 Blue Swirl
    pci_create_simple(d->host_state.bus, 14 << 3, "Uni-north internal");
281 2e29bd04 Blue Swirl
#endif
282 2e29bd04 Blue Swirl
283 2e29bd04 Blue Swirl
    return d->host_state.bus;
284 2e29bd04 Blue Swirl
}
285 2e29bd04 Blue Swirl
286 81a322d4 Gerd Hoffmann
static int unin_main_pci_host_init(PCIDevice *d)
287 2e29bd04 Blue Swirl
{
288 deb54399 aliguori
    pci_config_set_vendor_id(d->config, PCI_VENDOR_ID_APPLE);
289 4ebcf884 blueswir1
    pci_config_set_device_id(d->config, PCI_DEVICE_ID_APPLE_UNI_N_PCI);
290 502a5395 pbrook
    d->config[0x08] = 0x00; // revision
291 173a543b blueswir1
    pci_config_set_class(d->config, PCI_CLASS_BRIDGE_HOST);
292 502a5395 pbrook
    d->config[0x0C] = 0x08; // cache_line_size
293 502a5395 pbrook
    d->config[0x0D] = 0x10; // latency_timer
294 6407f373 Isaku Yamahata
    d->config[PCI_HEADER_TYPE] = PCI_HEADER_TYPE_NORMAL; // header_type
295 502a5395 pbrook
    d->config[0x34] = 0x00; // capabilities_pointer
296 81a322d4 Gerd Hoffmann
    return 0;
297 2e29bd04 Blue Swirl
}
298 502a5395 pbrook
299 81a322d4 Gerd Hoffmann
static int dec_21154_pci_host_init(PCIDevice *d)
300 2e29bd04 Blue Swirl
{
301 502a5395 pbrook
    /* pci-to-pci bridge */
302 4ebcf884 blueswir1
    pci_config_set_vendor_id(d->config, PCI_VENDOR_ID_DEC);
303 4ebcf884 blueswir1
    pci_config_set_device_id(d->config, PCI_DEVICE_ID_DEC_21154);
304 502a5395 pbrook
    d->config[0x08] = 0x05; // revision
305 173a543b blueswir1
    pci_config_set_class(d->config, PCI_CLASS_BRIDGE_PCI);
306 502a5395 pbrook
    d->config[0x0C] = 0x08; // cache_line_size
307 502a5395 pbrook
    d->config[0x0D] = 0x20; // latency_timer
308 6407f373 Isaku Yamahata
    d->config[PCI_HEADER_TYPE] = PCI_HEADER_TYPE_BRIDGE; // header_type
309 502a5395 pbrook
310 502a5395 pbrook
    d->config[0x18] = 0x01; // primary_bus
311 502a5395 pbrook
    d->config[0x19] = 0x02; // secondary_bus
312 502a5395 pbrook
    d->config[0x1A] = 0x02; // subordinate_bus
313 502a5395 pbrook
    d->config[0x1B] = 0x20; // secondary_latency_timer
314 502a5395 pbrook
    d->config[0x1C] = 0x11; // io_base
315 502a5395 pbrook
    d->config[0x1D] = 0x01; // io_limit
316 502a5395 pbrook
    d->config[0x20] = 0x00; // memory_base
317 502a5395 pbrook
    d->config[0x21] = 0x80;
318 502a5395 pbrook
    d->config[0x22] = 0x00; // memory_limit
319 502a5395 pbrook
    d->config[0x23] = 0x80;
320 502a5395 pbrook
    d->config[0x24] = 0x01; // prefetchable_memory_base
321 502a5395 pbrook
    d->config[0x25] = 0x80;
322 502a5395 pbrook
    d->config[0x26] = 0xF1; // prefectchable_memory_limit
323 502a5395 pbrook
    d->config[0x27] = 0x7F;
324 502a5395 pbrook
    // d->config[0x34] = 0xdc // capabilities_pointer
325 81a322d4 Gerd Hoffmann
    return 0;
326 2e29bd04 Blue Swirl
}
327 502a5395 pbrook
328 81a322d4 Gerd Hoffmann
static int unin_agp_pci_host_init(PCIDevice *d)
329 2e29bd04 Blue Swirl
{
330 deb54399 aliguori
    pci_config_set_vendor_id(d->config, PCI_VENDOR_ID_APPLE);
331 deb54399 aliguori
    pci_config_set_device_id(d->config, PCI_DEVICE_ID_APPLE_UNI_N_AGP);
332 502a5395 pbrook
    d->config[0x08] = 0x00; // revision
333 173a543b blueswir1
    pci_config_set_class(d->config, PCI_CLASS_BRIDGE_HOST);
334 502a5395 pbrook
    d->config[0x0C] = 0x08; // cache_line_size
335 502a5395 pbrook
    d->config[0x0D] = 0x10; // latency_timer
336 6407f373 Isaku Yamahata
    d->config[PCI_HEADER_TYPE] = PCI_HEADER_TYPE_NORMAL; // header_type
337 502a5395 pbrook
    //    d->config[0x34] = 0x80; // capabilities_pointer
338 81a322d4 Gerd Hoffmann
    return 0;
339 2e29bd04 Blue Swirl
}
340 502a5395 pbrook
341 81a322d4 Gerd Hoffmann
static int unin_internal_pci_host_init(PCIDevice *d)
342 2e29bd04 Blue Swirl
{
343 deb54399 aliguori
    pci_config_set_vendor_id(d->config, PCI_VENDOR_ID_APPLE);
344 4ebcf884 blueswir1
    pci_config_set_device_id(d->config, PCI_DEVICE_ID_APPLE_UNI_N_I_PCI);
345 502a5395 pbrook
    d->config[0x08] = 0x00; // revision
346 173a543b blueswir1
    pci_config_set_class(d->config, PCI_CLASS_BRIDGE_HOST);
347 502a5395 pbrook
    d->config[0x0C] = 0x08; // cache_line_size
348 502a5395 pbrook
    d->config[0x0D] = 0x10; // latency_timer
349 6407f373 Isaku Yamahata
    d->config[PCI_HEADER_TYPE] = PCI_HEADER_TYPE_NORMAL; // header_type
350 502a5395 pbrook
    d->config[0x34] = 0x00; // capabilities_pointer
351 81a322d4 Gerd Hoffmann
    return 0;
352 2e29bd04 Blue Swirl
}
353 2e29bd04 Blue Swirl
354 2e29bd04 Blue Swirl
static PCIDeviceInfo unin_main_pci_host_info = {
355 2e29bd04 Blue Swirl
    .qdev.name = "Uni-north main",
356 2e29bd04 Blue Swirl
    .qdev.size = sizeof(PCIDevice),
357 2e29bd04 Blue Swirl
    .init      = unin_main_pci_host_init,
358 2e29bd04 Blue Swirl
};
359 2e29bd04 Blue Swirl
360 2e29bd04 Blue Swirl
static PCIDeviceInfo dec_21154_pci_host_info = {
361 2e29bd04 Blue Swirl
    .qdev.name = "DEC 21154",
362 2e29bd04 Blue Swirl
    .qdev.size = sizeof(PCIDevice),
363 2e29bd04 Blue Swirl
    .init      = dec_21154_pci_host_init,
364 2e29bd04 Blue Swirl
};
365 f3902383 blueswir1
366 2e29bd04 Blue Swirl
static PCIDeviceInfo unin_agp_pci_host_info = {
367 2e29bd04 Blue Swirl
    .qdev.name = "Uni-north AGP",
368 2e29bd04 Blue Swirl
    .qdev.size = sizeof(PCIDevice),
369 2e29bd04 Blue Swirl
    .init      = unin_agp_pci_host_init,
370 2e29bd04 Blue Swirl
};
371 2e29bd04 Blue Swirl
372 2e29bd04 Blue Swirl
static PCIDeviceInfo unin_internal_pci_host_info = {
373 2e29bd04 Blue Swirl
    .qdev.name = "Uni-north internal",
374 2e29bd04 Blue Swirl
    .qdev.size = sizeof(PCIDevice),
375 2e29bd04 Blue Swirl
    .init      = unin_internal_pci_host_init,
376 2e29bd04 Blue Swirl
};
377 2e29bd04 Blue Swirl
378 2e29bd04 Blue Swirl
static void unin_register_devices(void)
379 2e29bd04 Blue Swirl
{
380 2e29bd04 Blue Swirl
    sysbus_register_dev("Uni-north main", sizeof(UNINState),
381 2e29bd04 Blue Swirl
                        pci_unin_main_init_device);
382 2e29bd04 Blue Swirl
    pci_qdev_register(&unin_main_pci_host_info);
383 2e29bd04 Blue Swirl
    sysbus_register_dev("DEC 21154", sizeof(UNINState),
384 2e29bd04 Blue Swirl
                        pci_dec_21154_init_device);
385 2e29bd04 Blue Swirl
    pci_qdev_register(&dec_21154_pci_host_info);
386 2e29bd04 Blue Swirl
    sysbus_register_dev("Uni-north AGP", sizeof(UNINState),
387 2e29bd04 Blue Swirl
                        pci_unin_agp_init_device);
388 2e29bd04 Blue Swirl
    pci_qdev_register(&unin_agp_pci_host_info);
389 2e29bd04 Blue Swirl
    sysbus_register_dev("Uni-north internal", sizeof(UNINState),
390 2e29bd04 Blue Swirl
                        pci_unin_internal_init_device);
391 2e29bd04 Blue Swirl
    pci_qdev_register(&unin_internal_pci_host_info);
392 502a5395 pbrook
}
393 2e29bd04 Blue Swirl
394 2e29bd04 Blue Swirl
device_init(unin_register_devices)