2006-05-13 16:11:23 +00:00
|
|
|
/*
|
|
|
|
* QEMU PREP PCI host
|
|
|
|
*
|
|
|
|
* Copyright (c) 2006 Fabrice Bellard
|
2012-05-26 17:14:52 +00:00
|
|
|
* Copyright (c) 2011-2013 Andreas Färber
|
2007-09-16 21:08:06 +00:00
|
|
|
*
|
2006-05-13 16:11:23 +00:00
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
* of this software and associated documentation files (the "Software"), to deal
|
|
|
|
* in the Software without restriction, including without limitation the rights
|
|
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
* copies of the Software, and to permit persons to whom the Software is
|
|
|
|
* furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be included in
|
|
|
|
* all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
* THE SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
2013-02-04 14:40:22 +00:00
|
|
|
#include "hw/hw.h"
|
|
|
|
#include "hw/pci/pci.h"
|
|
|
|
#include "hw/pci/pci_bus.h"
|
|
|
|
#include "hw/pci/pci_host.h"
|
2013-02-05 16:06:20 +00:00
|
|
|
#include "hw/i386/pc.h"
|
2013-11-04 23:09:45 +00:00
|
|
|
#include "hw/loader.h"
|
2012-12-17 17:19:49 +00:00
|
|
|
#include "exec/address-spaces.h"
|
2013-11-04 23:09:45 +00:00
|
|
|
#include "elf.h"
|
2006-05-13 16:11:23 +00:00
|
|
|
|
2012-05-26 17:14:52 +00:00
|
|
|
#define TYPE_RAVEN_PCI_DEVICE "raven"
|
2012-08-20 17:08:04 +00:00
|
|
|
#define TYPE_RAVEN_PCI_HOST_BRIDGE "raven-pcihost"
|
|
|
|
|
2012-05-26 17:14:52 +00:00
|
|
|
#define RAVEN_PCI_DEVICE(obj) \
|
|
|
|
OBJECT_CHECK(RavenPCIState, (obj), TYPE_RAVEN_PCI_DEVICE)
|
|
|
|
|
|
|
|
typedef struct RavenPCIState {
|
|
|
|
PCIDevice dev;
|
2013-11-04 23:09:45 +00:00
|
|
|
|
|
|
|
uint32_t elf_machine;
|
|
|
|
char *bios_name;
|
|
|
|
MemoryRegion bios;
|
2012-05-26 17:14:52 +00:00
|
|
|
} RavenPCIState;
|
|
|
|
|
2012-08-20 17:08:04 +00:00
|
|
|
#define RAVEN_PCI_HOST_BRIDGE(obj) \
|
|
|
|
OBJECT_CHECK(PREPPCIState, (obj), TYPE_RAVEN_PCI_HOST_BRIDGE)
|
|
|
|
|
2012-01-03 01:42:46 +00:00
|
|
|
typedef struct PRePPCIState {
|
2012-08-20 17:08:09 +00:00
|
|
|
PCIHostState parent_obj;
|
2012-08-20 17:08:04 +00:00
|
|
|
|
2013-11-04 23:09:44 +00:00
|
|
|
qemu_irq irq[PCI_NUM_PINS];
|
2012-05-26 17:14:52 +00:00
|
|
|
PCIBus pci_bus;
|
2014-03-17 22:00:20 +00:00
|
|
|
AddressSpace pci_io_as;
|
2014-03-17 22:00:21 +00:00
|
|
|
MemoryRegion pci_io;
|
2014-03-17 22:00:20 +00:00
|
|
|
MemoryRegion pci_io_non_contiguous;
|
2014-03-17 22:00:22 +00:00
|
|
|
MemoryRegion pci_memory;
|
2014-03-17 22:00:19 +00:00
|
|
|
MemoryRegion pci_intack;
|
2012-05-26 17:14:52 +00:00
|
|
|
RavenPCIState pci_dev;
|
2014-03-17 22:00:20 +00:00
|
|
|
|
|
|
|
int contiguous_map;
|
2012-01-03 01:42:46 +00:00
|
|
|
} PREPPCIState;
|
2006-05-13 16:11:23 +00:00
|
|
|
|
2013-11-04 23:09:45 +00:00
|
|
|
#define BIOS_SIZE (1024 * 1024)
|
|
|
|
|
2012-10-23 10:30:10 +00:00
|
|
|
static inline uint32_t PPC_PCIIO_config(hwaddr addr)
|
2006-05-13 16:11:23 +00:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
2012-08-20 17:08:04 +00:00
|
|
|
for (i = 0; i < 11; i++) {
|
|
|
|
if ((addr & (1 << (11 + i))) != 0) {
|
2006-05-13 16:11:23 +00:00
|
|
|
break;
|
2012-08-20 17:08:04 +00:00
|
|
|
}
|
2006-05-13 16:11:23 +00:00
|
|
|
}
|
|
|
|
return (addr & 0x7ff) | (i << 11);
|
|
|
|
}
|
|
|
|
|
2012-10-23 10:30:10 +00:00
|
|
|
static void ppc_pci_io_write(void *opaque, hwaddr addr,
|
2012-01-07 07:28:53 +00:00
|
|
|
uint64_t val, unsigned int size)
|
2006-05-13 16:11:23 +00:00
|
|
|
{
|
|
|
|
PREPPCIState *s = opaque;
|
2012-08-20 17:08:09 +00:00
|
|
|
PCIHostState *phb = PCI_HOST_BRIDGE(s);
|
|
|
|
pci_data_write(phb->bus, PPC_PCIIO_config(addr), val, size);
|
2006-05-13 16:11:23 +00:00
|
|
|
}
|
|
|
|
|
2012-10-23 10:30:10 +00:00
|
|
|
static uint64_t ppc_pci_io_read(void *opaque, hwaddr addr,
|
2012-01-07 07:28:53 +00:00
|
|
|
unsigned int size)
|
2006-05-13 16:11:23 +00:00
|
|
|
{
|
|
|
|
PREPPCIState *s = opaque;
|
2012-08-20 17:08:09 +00:00
|
|
|
PCIHostState *phb = PCI_HOST_BRIDGE(s);
|
|
|
|
return pci_data_read(phb->bus, PPC_PCIIO_config(addr), size);
|
2006-05-13 16:11:23 +00:00
|
|
|
}
|
|
|
|
|
2011-11-21 15:16:57 +00:00
|
|
|
static const MemoryRegionOps PPC_PCIIO_ops = {
|
2012-01-07 07:28:53 +00:00
|
|
|
.read = ppc_pci_io_read,
|
|
|
|
.write = ppc_pci_io_write,
|
2012-01-12 02:44:42 +00:00
|
|
|
.endianness = DEVICE_LITTLE_ENDIAN,
|
2006-05-13 16:11:23 +00:00
|
|
|
};
|
|
|
|
|
2012-10-23 10:30:10 +00:00
|
|
|
static uint64_t ppc_intack_read(void *opaque, hwaddr addr,
|
2012-04-14 20:48:37 +00:00
|
|
|
unsigned int size)
|
|
|
|
{
|
|
|
|
return pic_read_irq(isa_pic);
|
|
|
|
}
|
|
|
|
|
|
|
|
static const MemoryRegionOps PPC_intack_ops = {
|
|
|
|
.read = ppc_intack_read,
|
|
|
|
.valid = {
|
|
|
|
.max_access_size = 1,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2014-03-17 22:00:20 +00:00
|
|
|
static inline hwaddr raven_io_address(PREPPCIState *s,
|
|
|
|
hwaddr addr)
|
|
|
|
{
|
|
|
|
if (s->contiguous_map == 0) {
|
|
|
|
/* 64 KB contiguous space for IOs */
|
|
|
|
addr &= 0xFFFF;
|
|
|
|
} else {
|
|
|
|
/* 8 MB non-contiguous space for IOs */
|
|
|
|
addr = (addr & 0x1F) | ((addr & 0x007FFF000) >> 7);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* FIXME: handle endianness switch */
|
|
|
|
|
|
|
|
return addr;
|
|
|
|
}
|
|
|
|
|
|
|
|
static uint64_t raven_io_read(void *opaque, hwaddr addr,
|
|
|
|
unsigned int size)
|
|
|
|
{
|
|
|
|
PREPPCIState *s = opaque;
|
|
|
|
uint8_t buf[4];
|
|
|
|
|
|
|
|
addr = raven_io_address(s, addr);
|
2014-03-17 22:00:21 +00:00
|
|
|
address_space_read(&s->pci_io_as, addr + 0x80000000, buf, size);
|
2014-03-17 22:00:20 +00:00
|
|
|
|
|
|
|
if (size == 1) {
|
|
|
|
return buf[0];
|
|
|
|
} else if (size == 2) {
|
|
|
|
return lduw_p(buf);
|
|
|
|
} else if (size == 4) {
|
|
|
|
return ldl_p(buf);
|
|
|
|
} else {
|
|
|
|
g_assert_not_reached();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void raven_io_write(void *opaque, hwaddr addr,
|
|
|
|
uint64_t val, unsigned int size)
|
|
|
|
{
|
|
|
|
PREPPCIState *s = opaque;
|
|
|
|
uint8_t buf[4];
|
|
|
|
|
|
|
|
addr = raven_io_address(s, addr);
|
|
|
|
|
|
|
|
if (size == 1) {
|
|
|
|
buf[0] = val;
|
|
|
|
} else if (size == 2) {
|
|
|
|
stw_p(buf, val);
|
|
|
|
} else if (size == 4) {
|
|
|
|
stl_p(buf, val);
|
|
|
|
} else {
|
|
|
|
g_assert_not_reached();
|
|
|
|
}
|
|
|
|
|
2014-03-17 22:00:21 +00:00
|
|
|
address_space_write(&s->pci_io_as, addr + 0x80000000, buf, size);
|
2014-03-17 22:00:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static const MemoryRegionOps raven_io_ops = {
|
|
|
|
.read = raven_io_read,
|
|
|
|
.write = raven_io_write,
|
|
|
|
.endianness = DEVICE_LITTLE_ENDIAN,
|
|
|
|
.impl.max_access_size = 4,
|
|
|
|
.valid.unaligned = true,
|
|
|
|
};
|
|
|
|
|
2006-09-24 00:16:34 +00:00
|
|
|
static int prep_map_irq(PCIDevice *pci_dev, int irq_num)
|
2006-05-13 16:11:23 +00:00
|
|
|
{
|
2006-09-24 17:01:44 +00:00
|
|
|
return (irq_num + (pci_dev->devfn >> 3)) & 1;
|
2006-09-24 00:16:34 +00:00
|
|
|
}
|
|
|
|
|
2009-08-28 13:28:17 +00:00
|
|
|
static void prep_set_irq(void *opaque, int irq_num, int level)
|
2006-09-24 00:16:34 +00:00
|
|
|
{
|
2009-08-28 13:28:17 +00:00
|
|
|
qemu_irq *pic = opaque;
|
|
|
|
|
2012-01-03 01:42:46 +00:00
|
|
|
qemu_set_irq(pic[irq_num] , level);
|
2006-05-13 16:11:23 +00:00
|
|
|
}
|
|
|
|
|
2014-03-17 22:00:20 +00:00
|
|
|
static void raven_change_gpio(void *opaque, int n, int level)
|
|
|
|
{
|
|
|
|
PREPPCIState *s = opaque;
|
|
|
|
|
|
|
|
s->contiguous_map = level;
|
|
|
|
}
|
|
|
|
|
2013-01-16 14:45:34 +00:00
|
|
|
static void raven_pcihost_realizefn(DeviceState *d, Error **errp)
|
2006-05-13 16:11:23 +00:00
|
|
|
{
|
2013-01-16 14:45:34 +00:00
|
|
|
SysBusDevice *dev = SYS_BUS_DEVICE(d);
|
2012-08-20 17:08:08 +00:00
|
|
|
PCIHostState *h = PCI_HOST_BRIDGE(dev);
|
2012-08-20 17:08:04 +00:00
|
|
|
PREPPCIState *s = RAVEN_PCI_HOST_BRIDGE(dev);
|
2012-01-03 01:42:46 +00:00
|
|
|
MemoryRegion *address_space_mem = get_system_memory();
|
|
|
|
int i;
|
|
|
|
|
2013-11-04 23:09:44 +00:00
|
|
|
for (i = 0; i < PCI_NUM_PINS; i++) {
|
2012-01-03 01:42:46 +00:00
|
|
|
sysbus_init_irq(dev, &s->irq[i]);
|
|
|
|
}
|
2006-05-13 16:11:23 +00:00
|
|
|
|
2014-03-17 22:00:20 +00:00
|
|
|
qdev_init_gpio_in(d, raven_change_gpio, 1);
|
|
|
|
|
2013-11-04 23:09:44 +00:00
|
|
|
pci_bus_irqs(&s->pci_bus, prep_set_irq, prep_map_irq, s->irq, PCI_NUM_PINS);
|
2006-05-13 16:11:23 +00:00
|
|
|
|
2013-06-07 01:25:08 +00:00
|
|
|
memory_region_init_io(&h->conf_mem, OBJECT(h), &pci_host_conf_be_ops, s,
|
2011-07-24 14:47:18 +00:00
|
|
|
"pci-conf-idx", 1);
|
2014-03-17 22:00:21 +00:00
|
|
|
memory_region_add_subregion(&s->pci_io, 0xcf8, &h->conf_mem);
|
2011-07-24 14:47:18 +00:00
|
|
|
|
2013-06-07 01:25:08 +00:00
|
|
|
memory_region_init_io(&h->data_mem, OBJECT(h), &pci_host_data_be_ops, s,
|
2011-07-24 14:47:18 +00:00
|
|
|
"pci-conf-data", 1);
|
2014-03-17 22:00:21 +00:00
|
|
|
memory_region_add_subregion(&s->pci_io, 0xcfc, &h->data_mem);
|
2006-05-13 16:11:23 +00:00
|
|
|
|
2013-06-07 01:25:08 +00:00
|
|
|
memory_region_init_io(&h->mmcfg, OBJECT(s), &PPC_PCIIO_ops, s, "pciio", 0x00400000);
|
2012-01-03 01:42:46 +00:00
|
|
|
memory_region_add_subregion(address_space_mem, 0x80800000, &h->mmcfg);
|
2006-05-13 16:11:23 +00:00
|
|
|
|
2014-03-17 22:00:19 +00:00
|
|
|
memory_region_init_io(&s->pci_intack, OBJECT(s), &PPC_intack_ops, s,
|
|
|
|
"pci-intack", 1);
|
|
|
|
memory_region_add_subregion(address_space_mem, 0xbffffff0, &s->pci_intack);
|
2012-01-03 00:50:07 +00:00
|
|
|
|
2012-05-26 17:14:52 +00:00
|
|
|
/* TODO Remove once realize propagates to child devices. */
|
2013-01-16 14:45:34 +00:00
|
|
|
object_property_set_bool(OBJECT(&s->pci_dev), true, "realized", errp);
|
2012-05-26 17:14:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void raven_pcihost_initfn(Object *obj)
|
|
|
|
{
|
|
|
|
PCIHostState *h = PCI_HOST_BRIDGE(obj);
|
|
|
|
PREPPCIState *s = RAVEN_PCI_HOST_BRIDGE(obj);
|
|
|
|
MemoryRegion *address_space_mem = get_system_memory();
|
|
|
|
DeviceState *pci_dev;
|
|
|
|
|
2014-03-17 22:00:21 +00:00
|
|
|
memory_region_init(&s->pci_io, obj, "pci-io", 0x3f800000);
|
2014-03-17 22:00:20 +00:00
|
|
|
memory_region_init_io(&s->pci_io_non_contiguous, obj, &raven_io_ops, s,
|
|
|
|
"pci-io-non-contiguous", 0x00800000);
|
2014-03-17 22:00:22 +00:00
|
|
|
/* Open Hack'Ware hack: real size should be only 0x3f000000 bytes */
|
|
|
|
memory_region_init(&s->pci_memory, obj, "pci-memory",
|
|
|
|
0x3f000000 + 0xc0000000ULL);
|
2014-03-17 22:00:21 +00:00
|
|
|
address_space_init(&s->pci_io_as, &s->pci_io, "raven-io");
|
2014-03-17 22:00:20 +00:00
|
|
|
|
|
|
|
/* CPU address space */
|
2014-03-17 22:00:21 +00:00
|
|
|
memory_region_add_subregion(address_space_mem, 0x80000000, &s->pci_io);
|
2014-03-17 22:00:20 +00:00
|
|
|
memory_region_add_subregion_overlap(address_space_mem, 0x80000000,
|
|
|
|
&s->pci_io_non_contiguous, 1);
|
2014-03-17 22:00:22 +00:00
|
|
|
memory_region_add_subregion(address_space_mem, 0xc0000000, &s->pci_memory);
|
2013-08-23 18:23:55 +00:00
|
|
|
pci_bus_new_inplace(&s->pci_bus, sizeof(s->pci_bus), DEVICE(obj), NULL,
|
2014-03-17 22:00:22 +00:00
|
|
|
&s->pci_memory, &s->pci_io, 0, TYPE_PCI_BUS);
|
2014-03-17 22:00:21 +00:00
|
|
|
|
2012-05-26 17:14:52 +00:00
|
|
|
h->bus = &s->pci_bus;
|
|
|
|
|
2013-08-23 17:37:12 +00:00
|
|
|
object_initialize(&s->pci_dev, sizeof(s->pci_dev), TYPE_RAVEN_PCI_DEVICE);
|
2012-05-26 17:14:52 +00:00
|
|
|
pci_dev = DEVICE(&s->pci_dev);
|
|
|
|
qdev_set_parent_bus(pci_dev, BUS(&s->pci_bus));
|
|
|
|
object_property_set_int(OBJECT(&s->pci_dev), PCI_DEVFN(0, 0), "addr",
|
|
|
|
NULL);
|
|
|
|
qdev_prop_set_bit(pci_dev, "multifunction", false);
|
2012-01-03 00:50:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int raven_init(PCIDevice *d)
|
|
|
|
{
|
2013-11-04 23:09:45 +00:00
|
|
|
RavenPCIState *s = RAVEN_PCI_DEVICE(d);
|
|
|
|
char *filename;
|
|
|
|
int bios_size = -1;
|
|
|
|
|
2006-05-13 16:11:23 +00:00
|
|
|
d->config[0x0C] = 0x08; // cache_line_size
|
|
|
|
d->config[0x0D] = 0x10; // latency_timer
|
|
|
|
d->config[0x34] = 0x00; // capabilities_pointer
|
|
|
|
|
2013-11-04 23:09:45 +00:00
|
|
|
memory_region_init_ram(&s->bios, OBJECT(s), "bios", BIOS_SIZE);
|
|
|
|
memory_region_set_readonly(&s->bios, true);
|
|
|
|
memory_region_add_subregion(get_system_memory(), (uint32_t)(-BIOS_SIZE),
|
|
|
|
&s->bios);
|
|
|
|
vmstate_register_ram_global(&s->bios);
|
|
|
|
if (s->bios_name) {
|
|
|
|
filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, s->bios_name);
|
|
|
|
if (filename) {
|
|
|
|
if (s->elf_machine != EM_NONE) {
|
|
|
|
bios_size = load_elf(filename, NULL, NULL, NULL,
|
|
|
|
NULL, NULL, 1, s->elf_machine, 0);
|
|
|
|
}
|
|
|
|
if (bios_size < 0) {
|
|
|
|
bios_size = get_image_size(filename);
|
|
|
|
if (bios_size > 0 && bios_size <= BIOS_SIZE) {
|
|
|
|
hwaddr bios_addr;
|
|
|
|
bios_size = (bios_size + 0xfff) & ~0xfff;
|
|
|
|
bios_addr = (uint32_t)(-BIOS_SIZE);
|
|
|
|
bios_size = load_image_targphys(filename, bios_addr,
|
|
|
|
bios_size);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (bios_size < 0 || bios_size > BIOS_SIZE) {
|
|
|
|
hw_error("qemu: could not load bios image '%s'\n", s->bios_name);
|
|
|
|
}
|
|
|
|
if (filename) {
|
|
|
|
g_free(filename);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-01-03 00:50:07 +00:00
|
|
|
return 0;
|
2006-05-13 16:11:23 +00:00
|
|
|
}
|
2012-01-03 00:50:07 +00:00
|
|
|
|
|
|
|
static const VMStateDescription vmstate_raven = {
|
|
|
|
.name = "raven",
|
|
|
|
.version_id = 0,
|
|
|
|
.minimum_version_id = 0,
|
|
|
|
.fields = (VMStateField[]) {
|
|
|
|
VMSTATE_PCI_DEVICE(dev, RavenPCIState),
|
|
|
|
VMSTATE_END_OF_LIST()
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2011-12-04 18:22:06 +00:00
|
|
|
static void raven_class_init(ObjectClass *klass, void *data)
|
|
|
|
{
|
|
|
|
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
|
2011-12-08 03:34:16 +00:00
|
|
|
DeviceClass *dc = DEVICE_CLASS(klass);
|
2011-12-04 18:22:06 +00:00
|
|
|
|
|
|
|
k->init = raven_init;
|
|
|
|
k->vendor_id = PCI_VENDOR_ID_MOTOROLA;
|
|
|
|
k->device_id = PCI_DEVICE_ID_MOTOROLA_RAVEN;
|
|
|
|
k->revision = 0x00;
|
|
|
|
k->class_id = PCI_CLASS_BRIDGE_HOST;
|
2011-12-08 03:34:16 +00:00
|
|
|
dc->desc = "PReP Host Bridge - Motorola Raven";
|
|
|
|
dc->vmsd = &vmstate_raven;
|
pci-host: Consistently set cannot_instantiate_with_device_add_yet
Many PCI host bridges consist of a sysbus device and a PCI device.
You need both for the thing to work. Arguably, these bridges should
be modelled as a single, composite devices instead of pairs of
seemingly independent devices you can only use together, but we're not
there, yet.
Since the sysbus part can't be instantiated with device_add, yet,
permitting it with the PCI part is useless. We shouldn't offer
useless options to the user, so let's set
cannot_instantiate_with_device_add_yet for them.
It's already set for Bonito, Grackle, i440FX and Raven. Document why.
Set it for the others: dec-21154, e500-host-bridge, gt64120_pci, mch,
pbm-pci, ppc4xx-host-bridge, sh_pci_host, u3-agp, uni-north-agp,
uni-north-internal-pci, uni-north-pci, and versatile_pci_host.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Marcel Apfelbaum <marcel.a@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
2013-11-28 16:26:58 +00:00
|
|
|
/*
|
|
|
|
* PCI-facing part of the host bridge, not usable without the
|
|
|
|
* host-facing part, which can't be device_add'ed, yet.
|
|
|
|
*/
|
|
|
|
dc->cannot_instantiate_with_device_add_yet = true;
|
2011-12-04 18:22:06 +00:00
|
|
|
}
|
|
|
|
|
2012-08-20 17:07:56 +00:00
|
|
|
static const TypeInfo raven_info = {
|
2012-05-26 17:14:52 +00:00
|
|
|
.name = TYPE_RAVEN_PCI_DEVICE,
|
2011-12-08 03:34:16 +00:00
|
|
|
.parent = TYPE_PCI_DEVICE,
|
|
|
|
.instance_size = sizeof(RavenPCIState),
|
2011-12-04 18:22:06 +00:00
|
|
|
.class_init = raven_class_init,
|
2012-01-03 00:50:07 +00:00
|
|
|
};
|
|
|
|
|
2013-11-04 23:09:45 +00:00
|
|
|
static Property raven_pcihost_properties[] = {
|
|
|
|
DEFINE_PROP_UINT32("elf-machine", PREPPCIState, pci_dev.elf_machine,
|
|
|
|
EM_NONE),
|
|
|
|
DEFINE_PROP_STRING("bios-name", PREPPCIState, pci_dev.bios_name),
|
|
|
|
DEFINE_PROP_END_OF_LIST()
|
|
|
|
};
|
|
|
|
|
2012-01-24 19:12:29 +00:00
|
|
|
static void raven_pcihost_class_init(ObjectClass *klass, void *data)
|
|
|
|
{
|
2011-12-08 03:34:16 +00:00
|
|
|
DeviceClass *dc = DEVICE_CLASS(klass);
|
2012-01-24 19:12:29 +00:00
|
|
|
|
2013-07-29 14:17:45 +00:00
|
|
|
set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
|
2013-01-16 14:45:34 +00:00
|
|
|
dc->realize = raven_pcihost_realizefn;
|
2013-11-04 23:09:45 +00:00
|
|
|
dc->props = raven_pcihost_properties;
|
2011-12-08 03:34:16 +00:00
|
|
|
dc->fw_name = "pci";
|
2012-01-24 19:12:29 +00:00
|
|
|
}
|
|
|
|
|
2012-08-20 17:07:56 +00:00
|
|
|
static const TypeInfo raven_pcihost_info = {
|
2012-08-20 17:08:04 +00:00
|
|
|
.name = TYPE_RAVEN_PCI_HOST_BRIDGE,
|
2012-08-20 17:08:08 +00:00
|
|
|
.parent = TYPE_PCI_HOST_BRIDGE,
|
2011-12-08 03:34:16 +00:00
|
|
|
.instance_size = sizeof(PREPPCIState),
|
2012-05-26 17:14:52 +00:00
|
|
|
.instance_init = raven_pcihost_initfn,
|
2012-01-24 19:12:29 +00:00
|
|
|
.class_init = raven_pcihost_class_init,
|
2012-01-03 01:42:46 +00:00
|
|
|
};
|
|
|
|
|
2012-02-09 14:20:55 +00:00
|
|
|
static void raven_register_types(void)
|
2012-01-03 00:50:07 +00:00
|
|
|
{
|
2011-12-08 03:34:16 +00:00
|
|
|
type_register_static(&raven_pcihost_info);
|
|
|
|
type_register_static(&raven_info);
|
2012-01-03 00:50:07 +00:00
|
|
|
}
|
|
|
|
|
2012-02-09 14:20:55 +00:00
|
|
|
type_init(raven_register_types)
|