]> Git Repo - qemu.git/blame - hw/pci-host/ppce500.c
exec: RCUify AddressSpaceDispatch
[qemu.git] / hw / pci-host / ppce500.c
CommitLineData
74c62ba8
AJ
1/*
2 * QEMU PowerPC E500 embedded processors pci controller emulation
3 *
4 * Copyright (C) 2009 Freescale Semiconductor, Inc. All rights reserved.
5 *
6 * Author: Yu Liu, <[email protected]>
7 *
8 * This file is derived from hw/ppc4xx_pci.c,
9 * the copyright for that material belongs to the original owners.
10 *
11 * This is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 */
16
83c9f4ca 17#include "hw/hw.h"
3eddc1be 18#include "hw/ppc/e500-ccsr.h"
83c9f4ca
PB
19#include "hw/pci/pci.h"
20#include "hw/pci/pci_host.h"
1de7afc9 21#include "qemu/bswap.h"
0d09e41a 22#include "hw/pci-host/ppce500.h"
74c62ba8
AJ
23
24#ifdef DEBUG_PCI
001faf32 25#define pci_debug(fmt, ...) fprintf(stderr, fmt, ## __VA_ARGS__)
74c62ba8 26#else
001faf32 27#define pci_debug(fmt, ...)
74c62ba8
AJ
28#endif
29
30#define PCIE500_CFGADDR 0x0
31#define PCIE500_CFGDATA 0x4
32#define PCIE500_REG_BASE 0xC00
be13cc7a
AG
33#define PCIE500_ALL_SIZE 0x1000
34#define PCIE500_REG_SIZE (PCIE500_ALL_SIZE - PCIE500_REG_BASE)
74c62ba8 35
a1bc20df
AG
36#define PCIE500_PCI_IOLEN 0x10000ULL
37
74c62ba8
AJ
38#define PPCE500_PCI_CONFIG_ADDR 0x0
39#define PPCE500_PCI_CONFIG_DATA 0x4
40#define PPCE500_PCI_INTACK 0x8
41
42#define PPCE500_PCI_OW1 (0xC20 - PCIE500_REG_BASE)
43#define PPCE500_PCI_OW2 (0xC40 - PCIE500_REG_BASE)
44#define PPCE500_PCI_OW3 (0xC60 - PCIE500_REG_BASE)
45#define PPCE500_PCI_OW4 (0xC80 - PCIE500_REG_BASE)
46#define PPCE500_PCI_IW3 (0xDA0 - PCIE500_REG_BASE)
47#define PPCE500_PCI_IW2 (0xDC0 - PCIE500_REG_BASE)
48#define PPCE500_PCI_IW1 (0xDE0 - PCIE500_REG_BASE)
49
50#define PPCE500_PCI_GASKET_TIMR (0xE20 - PCIE500_REG_BASE)
51
52#define PCI_POTAR 0x0
53#define PCI_POTEAR 0x4
54#define PCI_POWBAR 0x8
55#define PCI_POWAR 0x10
56
57#define PCI_PITAR 0x0
58#define PCI_PIWBAR 0x8
59#define PCI_PIWBEAR 0xC
60#define PCI_PIWAR 0x10
61
62#define PPCE500_PCI_NR_POBS 5
63#define PPCE500_PCI_NR_PIBS 3
64
cb3778a0
AG
65#define PIWAR_EN 0x80000000 /* Enable */
66#define PIWAR_PF 0x20000000 /* prefetch */
67#define PIWAR_TGI_LOCAL 0x00f00000 /* target - local memory */
68#define PIWAR_READ_SNOOP 0x00050000
69#define PIWAR_WRITE_SNOOP 0x00005000
70#define PIWAR_SZ_MASK 0x0000003f
71
74c62ba8
AJ
72struct pci_outbound {
73 uint32_t potar;
74 uint32_t potear;
75 uint32_t powbar;
76 uint32_t powar;
cb3778a0 77 MemoryRegion mem;
74c62ba8
AJ
78};
79
80struct pci_inbound {
81 uint32_t pitar;
82 uint32_t piwbar;
83 uint32_t piwbear;
84 uint32_t piwar;
cb3778a0 85 MemoryRegion mem;
74c62ba8
AJ
86};
87
9c1a61f0
AF
88#define TYPE_PPC_E500_PCI_HOST_BRIDGE "e500-pcihost"
89
90#define PPC_E500_PCI_HOST_BRIDGE(obj) \
91 OBJECT_CHECK(PPCE500PCIState, (obj), TYPE_PPC_E500_PCI_HOST_BRIDGE)
92
74c62ba8 93struct PPCE500PCIState {
67c332fd 94 PCIHostState parent_obj;
9c1a61f0 95
74c62ba8
AJ
96 struct pci_outbound pob[PPCE500_PCI_NR_POBS];
97 struct pci_inbound pib[PPCE500_PCI_NR_PIBS];
98 uint32_t gasket_time;
d575a6ce 99 qemu_irq irq[PCI_NUM_PINS];
3016dca0 100 uint32_t irq_num[PCI_NUM_PINS];
eafb325f 101 uint32_t first_slot;
3016dca0 102 uint32_t first_pin_irq;
cb3778a0
AG
103 AddressSpace bm_as;
104 MemoryRegion bm;
be13cc7a 105 /* mmio maps */
cb4e15c7 106 MemoryRegion container;
cd5cba79 107 MemoryRegion iomem;
a1bc20df 108 MemoryRegion pio;
cb3778a0 109 MemoryRegion busmem;
74c62ba8
AJ
110};
111
3eddc1be
BB
112#define TYPE_PPC_E500_PCI_BRIDGE "e500-host-bridge"
113#define PPC_E500_PCI_BRIDGE(obj) \
114 OBJECT_CHECK(PPCE500PCIBridgeState, (obj), TYPE_PPC_E500_PCI_BRIDGE)
115
116struct PPCE500PCIBridgeState {
117 /*< private >*/
118 PCIDevice parent;
119 /*< public >*/
120
121 MemoryRegion bar0;
122};
123
124typedef struct PPCE500PCIBridgeState PPCE500PCIBridgeState;
74c62ba8
AJ
125typedef struct PPCE500PCIState PPCE500PCIState;
126
a8170e5e 127static uint64_t pci_reg_read4(void *opaque, hwaddr addr,
cd5cba79 128 unsigned size)
74c62ba8
AJ
129{
130 PPCE500PCIState *pci = opaque;
131 unsigned long win;
132 uint32_t value = 0;
eeae2e7b 133 int idx;
74c62ba8
AJ
134
135 win = addr & 0xfe0;
136
137 switch (win) {
138 case PPCE500_PCI_OW1:
139 case PPCE500_PCI_OW2:
140 case PPCE500_PCI_OW3:
141 case PPCE500_PCI_OW4:
eeae2e7b 142 idx = (addr >> 5) & 0x7;
74c62ba8 143 switch (addr & 0xC) {
6875dc8e 144 case PCI_POTAR:
eeae2e7b 145 value = pci->pob[idx].potar;
6875dc8e
LY
146 break;
147 case PCI_POTEAR:
eeae2e7b 148 value = pci->pob[idx].potear;
6875dc8e
LY
149 break;
150 case PCI_POWBAR:
eeae2e7b 151 value = pci->pob[idx].powbar;
6875dc8e
LY
152 break;
153 case PCI_POWAR:
eeae2e7b 154 value = pci->pob[idx].powar;
6875dc8e
LY
155 break;
156 default:
157 break;
74c62ba8
AJ
158 }
159 break;
160
161 case PPCE500_PCI_IW3:
162 case PPCE500_PCI_IW2:
163 case PPCE500_PCI_IW1:
eeae2e7b 164 idx = ((addr >> 5) & 0x3) - 1;
74c62ba8 165 switch (addr & 0xC) {
6875dc8e 166 case PCI_PITAR:
eeae2e7b 167 value = pci->pib[idx].pitar;
6875dc8e
LY
168 break;
169 case PCI_PIWBAR:
eeae2e7b 170 value = pci->pib[idx].piwbar;
6875dc8e
LY
171 break;
172 case PCI_PIWBEAR:
eeae2e7b 173 value = pci->pib[idx].piwbear;
6875dc8e
LY
174 break;
175 case PCI_PIWAR:
eeae2e7b 176 value = pci->pib[idx].piwar;
6875dc8e
LY
177 break;
178 default:
179 break;
74c62ba8
AJ
180 };
181 break;
182
183 case PPCE500_PCI_GASKET_TIMR:
184 value = pci->gasket_time;
185 break;
186
187 default:
188 break;
189 }
190
c0a2a096
BS
191 pci_debug("%s: win:%lx(addr:" TARGET_FMT_plx ") -> value:%x\n", __func__,
192 win, addr, value);
74c62ba8
AJ
193 return value;
194}
195
cb3778a0
AG
196/* DMA mapping */
197static void e500_update_piw(PPCE500PCIState *pci, int idx)
198{
199 uint64_t tar = ((uint64_t)pci->pib[idx].pitar) << 12;
200 uint64_t wbar = ((uint64_t)pci->pib[idx].piwbar) << 12;
201 uint64_t war = pci->pib[idx].piwar;
202 uint64_t size = 2ULL << (war & PIWAR_SZ_MASK);
203 MemoryRegion *address_space_mem = get_system_memory();
204 MemoryRegion *mem = &pci->pib[idx].mem;
205 MemoryRegion *bm = &pci->bm;
206 char *name;
207
208 if (memory_region_is_mapped(mem)) {
209 /* Before we modify anything, unmap and destroy the region */
210 memory_region_del_subregion(bm, mem);
211 object_unparent(OBJECT(mem));
212 }
213
214 if (!(war & PIWAR_EN)) {
215 /* Not enabled, nothing to do */
216 return;
217 }
218
219 name = g_strdup_printf("PCI Inbound Window %d", idx);
220 memory_region_init_alias(mem, OBJECT(pci), name, address_space_mem, tar,
221 size);
222 memory_region_add_subregion_overlap(bm, wbar, mem, -1);
223 g_free(name);
224
225 pci_debug("%s: Added window of size=%#lx from PCI=%#lx to CPU=%#lx\n",
226 __func__, size, wbar, tar);
227}
228
229/* BAR mapping */
230static void e500_update_pow(PPCE500PCIState *pci, int idx)
231{
232 uint64_t tar = ((uint64_t)pci->pob[idx].potar) << 12;
233 uint64_t wbar = ((uint64_t)pci->pob[idx].powbar) << 12;
234 uint64_t war = pci->pob[idx].powar;
235 uint64_t size = 2ULL << (war & PIWAR_SZ_MASK);
236 MemoryRegion *mem = &pci->pob[idx].mem;
237 MemoryRegion *address_space_mem = get_system_memory();
238 char *name;
239
240 if (memory_region_is_mapped(mem)) {
241 /* Before we modify anything, unmap and destroy the region */
242 memory_region_del_subregion(address_space_mem, mem);
243 object_unparent(OBJECT(mem));
244 }
245
246 if (!(war & PIWAR_EN)) {
247 /* Not enabled, nothing to do */
248 return;
249 }
250
251 name = g_strdup_printf("PCI Outbound Window %d", idx);
252 memory_region_init_alias(mem, OBJECT(pci), name, &pci->busmem, tar,
253 size);
254 memory_region_add_subregion(address_space_mem, wbar, mem);
255 g_free(name);
256
257 pci_debug("%s: Added window of size=%#lx from CPU=%#lx to PCI=%#lx\n",
258 __func__, size, wbar, tar);
259}
260
a8170e5e 261static void pci_reg_write4(void *opaque, hwaddr addr,
cd5cba79 262 uint64_t value, unsigned size)
74c62ba8
AJ
263{
264 PPCE500PCIState *pci = opaque;
265 unsigned long win;
eeae2e7b 266 int idx;
74c62ba8
AJ
267
268 win = addr & 0xfe0;
269
c0a2a096 270 pci_debug("%s: value:%x -> win:%lx(addr:" TARGET_FMT_plx ")\n",
cd5cba79 271 __func__, (unsigned)value, win, addr);
74c62ba8
AJ
272
273 switch (win) {
274 case PPCE500_PCI_OW1:
275 case PPCE500_PCI_OW2:
276 case PPCE500_PCI_OW3:
277 case PPCE500_PCI_OW4:
eeae2e7b 278 idx = (addr >> 5) & 0x7;
cb3778a0 279 switch (addr & 0x1F) {
6875dc8e 280 case PCI_POTAR:
eeae2e7b 281 pci->pob[idx].potar = value;
cb3778a0 282 e500_update_pow(pci, idx);
6875dc8e
LY
283 break;
284 case PCI_POTEAR:
eeae2e7b 285 pci->pob[idx].potear = value;
cb3778a0 286 e500_update_pow(pci, idx);
6875dc8e
LY
287 break;
288 case PCI_POWBAR:
eeae2e7b 289 pci->pob[idx].powbar = value;
cb3778a0 290 e500_update_pow(pci, idx);
6875dc8e
LY
291 break;
292 case PCI_POWAR:
eeae2e7b 293 pci->pob[idx].powar = value;
cb3778a0 294 e500_update_pow(pci, idx);
6875dc8e
LY
295 break;
296 default:
297 break;
74c62ba8
AJ
298 };
299 break;
300
301 case PPCE500_PCI_IW3:
302 case PPCE500_PCI_IW2:
303 case PPCE500_PCI_IW1:
eeae2e7b 304 idx = ((addr >> 5) & 0x3) - 1;
cb3778a0 305 switch (addr & 0x1F) {
6875dc8e 306 case PCI_PITAR:
eeae2e7b 307 pci->pib[idx].pitar = value;
cb3778a0 308 e500_update_piw(pci, idx);
6875dc8e
LY
309 break;
310 case PCI_PIWBAR:
eeae2e7b 311 pci->pib[idx].piwbar = value;
cb3778a0 312 e500_update_piw(pci, idx);
6875dc8e
LY
313 break;
314 case PCI_PIWBEAR:
eeae2e7b 315 pci->pib[idx].piwbear = value;
cb3778a0 316 e500_update_piw(pci, idx);
6875dc8e
LY
317 break;
318 case PCI_PIWAR:
eeae2e7b 319 pci->pib[idx].piwar = value;
cb3778a0 320 e500_update_piw(pci, idx);
6875dc8e
LY
321 break;
322 default:
323 break;
74c62ba8
AJ
324 };
325 break;
326
327 case PPCE500_PCI_GASKET_TIMR:
328 pci->gasket_time = value;
329 break;
330
331 default:
332 break;
333 };
334}
335
cd5cba79
AK
336static const MemoryRegionOps e500_pci_reg_ops = {
337 .read = pci_reg_read4,
338 .write = pci_reg_write4,
339 .endianness = DEVICE_BIG_ENDIAN,
74c62ba8
AJ
340};
341
d575a6ce 342static int mpc85xx_pci_map_irq(PCIDevice *pci_dev, int pin)
74c62ba8 343{
05f57d9d
AG
344 int devno = pci_dev->devfn >> 3;
345 int ret;
74c62ba8 346
d575a6ce 347 ret = ppce500_pci_map_irq_slot(devno, pin);
74c62ba8
AJ
348
349 pci_debug("%s: devfn %x irq %d -> %d devno:%x\n", __func__,
d575a6ce 350 pci_dev->devfn, pin, ret, devno);
74c62ba8
AJ
351
352 return ret;
353}
354
d575a6ce 355static void mpc85xx_pci_set_irq(void *opaque, int pin, int level)
74c62ba8 356{
3016dca0
BB
357 PPCE500PCIState *s = opaque;
358 qemu_irq *pic = s->irq;
5d4e84c8 359
d575a6ce 360 pci_debug("%s: PCI irq %d, level:%d\n", __func__, pin , level);
74c62ba8 361
d575a6ce 362 qemu_set_irq(pic[pin], level);
74c62ba8
AJ
363}
364
3016dca0
BB
365static PCIINTxRoute e500_route_intx_pin_to_irq(void *opaque, int pin)
366{
367 PCIINTxRoute route;
368 PPCE500PCIState *s = opaque;
369
370 route.mode = PCI_INTX_ENABLED;
371 route.irq = s->irq_num[pin];
372
373 pci_debug("%s: PCI irq-pin = %d, irq_num= %d\n", __func__, pin, route.irq);
374 return route;
375}
376
e0433ecc
JQ
377static const VMStateDescription vmstate_pci_outbound = {
378 .name = "pci_outbound",
379 .version_id = 0,
380 .minimum_version_id = 0,
3aff6c2f 381 .fields = (VMStateField[]) {
e0433ecc
JQ
382 VMSTATE_UINT32(potar, struct pci_outbound),
383 VMSTATE_UINT32(potear, struct pci_outbound),
384 VMSTATE_UINT32(powbar, struct pci_outbound),
385 VMSTATE_UINT32(powar, struct pci_outbound),
386 VMSTATE_END_OF_LIST()
74c62ba8 387 }
e0433ecc 388};
74c62ba8 389
e0433ecc
JQ
390static const VMStateDescription vmstate_pci_inbound = {
391 .name = "pci_inbound",
392 .version_id = 0,
393 .minimum_version_id = 0,
3aff6c2f 394 .fields = (VMStateField[]) {
e0433ecc
JQ
395 VMSTATE_UINT32(pitar, struct pci_inbound),
396 VMSTATE_UINT32(piwbar, struct pci_inbound),
397 VMSTATE_UINT32(piwbear, struct pci_inbound),
398 VMSTATE_UINT32(piwar, struct pci_inbound),
399 VMSTATE_END_OF_LIST()
74c62ba8 400 }
e0433ecc 401};
74c62ba8 402
e0433ecc
JQ
403static const VMStateDescription vmstate_ppce500_pci = {
404 .name = "ppce500_pci",
405 .version_id = 1,
406 .minimum_version_id = 1,
3aff6c2f 407 .fields = (VMStateField[]) {
e0433ecc
JQ
408 VMSTATE_STRUCT_ARRAY(pob, PPCE500PCIState, PPCE500_PCI_NR_POBS, 1,
409 vmstate_pci_outbound, struct pci_outbound),
410 VMSTATE_STRUCT_ARRAY(pib, PPCE500PCIState, PPCE500_PCI_NR_PIBS, 1,
f2e2bc9c 411 vmstate_pci_inbound, struct pci_inbound),
e0433ecc
JQ
412 VMSTATE_UINT32(gasket_time, PPCE500PCIState),
413 VMSTATE_END_OF_LIST()
74c62ba8 414 }
e0433ecc 415};
74c62ba8 416
022c62cb 417#include "exec/address-spaces.h"
1e39101c 418
3eddc1be
BB
419static int e500_pcihost_bridge_initfn(PCIDevice *d)
420{
421 PPCE500PCIBridgeState *b = PPC_E500_PCI_BRIDGE(d);
422 PPCE500CCSRState *ccsr = CCSR(container_get(qdev_get_machine(),
423 "/e500-ccsr"));
424
99750506
AG
425 pci_config_set_class(d->config, PCI_CLASS_BRIDGE_PCI);
426 d->config[PCI_HEADER_TYPE] =
427 (d->config[PCI_HEADER_TYPE] & PCI_HEADER_TYPE_MULTI_FUNCTION) |
428 PCI_HEADER_TYPE_BRIDGE;
429
40c5dce9 430 memory_region_init_alias(&b->bar0, OBJECT(ccsr), "e500-pci-bar0", &ccsr->ccsr_space,
3eddc1be
BB
431 0, int128_get64(ccsr->ccsr_space.size));
432 pci_register_bar(d, 0, PCI_BASE_ADDRESS_SPACE_MEMORY, &b->bar0);
99750506 433
3eddc1be
BB
434 return 0;
435}
436
cb3778a0
AG
437static AddressSpace *e500_pcihost_set_iommu(PCIBus *bus, void *opaque,
438 int devfn)
439{
440 PPCE500PCIState *s = opaque;
441
442 return &s->bm_as;
443}
444
be13cc7a
AG
445static int e500_pcihost_initfn(SysBusDevice *dev)
446{
447 PCIHostState *h;
448 PPCE500PCIState *s;
449 PCIBus *b;
450 int i;
451
8558d942 452 h = PCI_HOST_BRIDGE(dev);
9c1a61f0 453 s = PPC_E500_PCI_HOST_BRIDGE(dev);
be13cc7a
AG
454
455 for (i = 0; i < ARRAY_SIZE(s->irq); i++) {
456 sysbus_init_irq(dev, &s->irq[i]);
457 }
458
3016dca0
BB
459 for (i = 0; i < PCI_NUM_PINS; i++) {
460 s->irq_num[i] = s->first_pin_irq + i;
461 }
462
40c5dce9 463 memory_region_init(&s->pio, OBJECT(s), "pci-pio", PCIE500_PCI_IOLEN);
cb3778a0
AG
464 memory_region_init(&s->busmem, OBJECT(s), "pci bus memory", UINT64_MAX);
465
466 /* PIO lives at the bottom of our bus space */
467 memory_region_add_subregion_overlap(&s->busmem, 0, &s->pio, -2);
a1bc20df 468
9c1a61f0 469 b = pci_register_bus(DEVICE(dev), NULL, mpc85xx_pci_set_irq,
cb3778a0
AG
470 mpc85xx_pci_map_irq, s, &s->busmem, &s->pio,
471 PCI_DEVFN(s->first_slot, 0), 4, TYPE_PCI_BUS);
9c1a61f0 472 h->bus = b;
be13cc7a 473
cb3778a0
AG
474 /* Set up PCI view of memory */
475 memory_region_init(&s->bm, OBJECT(s), "bm-e500", UINT64_MAX);
476 memory_region_add_subregion(&s->bm, 0x0, &s->busmem);
477 address_space_init(&s->bm_as, &s->bm, "pci-bm");
478 pci_setup_iommu(b, e500_pcihost_set_iommu, s);
479
be13cc7a
AG
480 pci_create_simple(b, 0, "e500-host-bridge");
481
40c5dce9
PB
482 memory_region_init(&s->container, OBJECT(h), "pci-container", PCIE500_ALL_SIZE);
483 memory_region_init_io(&h->conf_mem, OBJECT(h), &pci_host_conf_be_ops, h,
d0ed8076 484 "pci-conf-idx", 4);
40c5dce9 485 memory_region_init_io(&h->data_mem, OBJECT(h), &pci_host_data_le_ops, h,
d0ed8076 486 "pci-conf-data", 4);
40c5dce9 487 memory_region_init_io(&s->iomem, OBJECT(s), &e500_pci_reg_ops, s,
cd5cba79 488 "pci.reg", PCIE500_REG_SIZE);
cb4e15c7
BC
489 memory_region_add_subregion(&s->container, PCIE500_CFGADDR, &h->conf_mem);
490 memory_region_add_subregion(&s->container, PCIE500_CFGDATA, &h->data_mem);
491 memory_region_add_subregion(&s->container, PCIE500_REG_BASE, &s->iomem);
492 sysbus_init_mmio(dev, &s->container);
3016dca0 493 pci_bus_set_route_irq_fn(b, e500_route_intx_pin_to_irq);
be13cc7a
AG
494
495 return 0;
496}
497
40021f08
AL
498static void e500_host_bridge_class_init(ObjectClass *klass, void *data)
499{
39bffca2 500 DeviceClass *dc = DEVICE_CLASS(klass);
40021f08
AL
501 PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
502
3eddc1be 503 k->init = e500_pcihost_bridge_initfn;
40021f08
AL
504 k->vendor_id = PCI_VENDOR_ID_FREESCALE;
505 k->device_id = PCI_DEVICE_ID_MPC8533E;
506 k->class_id = PCI_CLASS_PROCESSOR_POWERPC;
39bffca2 507 dc->desc = "Host bridge";
08c58f92
MA
508 /*
509 * PCI-facing part of the host bridge, not usable without the
510 * host-facing part, which can't be device_add'ed, yet.
511 */
512 dc->cannot_instantiate_with_device_add_yet = true;
40021f08
AL
513}
514
4240abff 515static const TypeInfo e500_host_bridge_info = {
39bffca2
AL
516 .name = "e500-host-bridge",
517 .parent = TYPE_PCI_DEVICE,
3eddc1be 518 .instance_size = sizeof(PPCE500PCIBridgeState),
39bffca2 519 .class_init = e500_host_bridge_class_init,
be13cc7a
AG
520};
521
eafb325f
AG
522static Property pcihost_properties[] = {
523 DEFINE_PROP_UINT32("first_slot", PPCE500PCIState, first_slot, 0x11),
3016dca0 524 DEFINE_PROP_UINT32("first_pin_irq", PPCE500PCIState, first_pin_irq, 0x1),
eafb325f
AG
525 DEFINE_PROP_END_OF_LIST(),
526};
527
999e12bb
AL
528static void e500_pcihost_class_init(ObjectClass *klass, void *data)
529{
39bffca2 530 DeviceClass *dc = DEVICE_CLASS(klass);
999e12bb
AL
531 SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
532
533 k->init = e500_pcihost_initfn;
125ee0ed 534 set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
eafb325f 535 dc->props = pcihost_properties;
39bffca2 536 dc->vmsd = &vmstate_ppce500_pci;
999e12bb
AL
537}
538
4240abff 539static const TypeInfo e500_pcihost_info = {
9c1a61f0 540 .name = TYPE_PPC_E500_PCI_HOST_BRIDGE,
8558d942 541 .parent = TYPE_PCI_HOST_BRIDGE,
39bffca2
AL
542 .instance_size = sizeof(PPCE500PCIState),
543 .class_init = e500_pcihost_class_init,
be13cc7a
AG
544};
545
83f7d43a 546static void e500_pci_register_types(void)
74c62ba8 547{
39bffca2
AL
548 type_register_static(&e500_pcihost_info);
549 type_register_static(&e500_host_bridge_info);
74c62ba8 550}
83f7d43a
AF
551
552type_init(e500_pci_register_types)
This page took 0.763031 seconds and 4 git commands to generate.