Statistics
| Branch: | Revision:

root / hw / piix_pci.c @ 3e3648b2

History | View | Annotate | Download (19.4 kB)

1 502a5395 pbrook
/*
2 502a5395 pbrook
 * QEMU i440FX/PIIX3 PCI Bridge Emulation
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 502a5395 pbrook
25 87ecb68b pbrook
#include "hw.h"
26 87ecb68b pbrook
#include "pc.h"
27 a2cb15b0 Michael S. Tsirkin
#include "pci/pci.h"
28 a2cb15b0 Michael S. Tsirkin
#include "pci/pci_host.h"
29 f75247f1 Gerd Hoffmann
#include "isa.h"
30 8a14daa5 Gerd Hoffmann
#include "sysbus.h"
31 1de7afc9 Paolo Bonzini
#include "qemu/range.h"
32 41445300 Anthony PERARD
#include "xen.h"
33 410edd92 Isaku Yamahata
#include "pam.h"
34 1ec4ba74 Laszlo Ersek
#include "sysemu/sysemu.h"
35 87ecb68b pbrook
36 56594fe3 Isaku Yamahata
/*
37 56594fe3 Isaku Yamahata
 * I440FX chipset data sheet.
38 56594fe3 Isaku Yamahata
 * http://download.intel.com/design/chipsets/datashts/29054901.pdf
39 56594fe3 Isaku Yamahata
 */
40 56594fe3 Isaku Yamahata
41 67c332fd Andreas Färber
typedef struct I440FXState {
42 67c332fd Andreas Färber
    PCIHostState parent_obj;
43 67c332fd Andreas Färber
} I440FXState;
44 502a5395 pbrook
45 ab431c28 Isaku Yamahata
#define PIIX_NUM_PIC_IRQS       16      /* i8259 * 2 */
46 e735b55a Isaku Yamahata
#define PIIX_NUM_PIRQS          4ULL    /* PIRQ[A-D] */
47 bf09551a Stefano Stabellini
#define XEN_PIIX_NUM_PIRQS      128ULL
48 ab431c28 Isaku Yamahata
#define PIIX_PIRQC              0x60
49 e735b55a Isaku Yamahata
50 1ec4ba74 Laszlo Ersek
/*
51 1ec4ba74 Laszlo Ersek
 * Reset Control Register: PCI-accessible ISA-Compatible Register at address
52 1ec4ba74 Laszlo Ersek
 * 0xcf9, provided by the PCI/ISA bridge (PIIX3 PCI function 0, 8086:7000).
53 1ec4ba74 Laszlo Ersek
 */
54 1ec4ba74 Laszlo Ersek
#define RCR_IOPORT 0xcf9
55 1ec4ba74 Laszlo Ersek
56 fd37d881 Juan Quintela
typedef struct PIIX3State {
57 fd37d881 Juan Quintela
    PCIDevice dev;
58 ab431c28 Isaku Yamahata
59 ab431c28 Isaku Yamahata
    /*
60 ab431c28 Isaku Yamahata
     * bitmap to track pic levels.
61 ab431c28 Isaku Yamahata
     * The pic level is the logical OR of all the PCI irqs mapped to it
62 ab431c28 Isaku Yamahata
     * So one PIC level is tracked by PIIX_NUM_PIRQS bits.
63 ab431c28 Isaku Yamahata
     *
64 ab431c28 Isaku Yamahata
     * PIRQ is mapped to PIC pins, we track it by
65 ab431c28 Isaku Yamahata
     * PIIX_NUM_PIRQS * PIIX_NUM_PIC_IRQS = 64 bits with
66 ab431c28 Isaku Yamahata
     * pic_irq * PIIX_NUM_PIRQS + pirq
67 ab431c28 Isaku Yamahata
     */
68 ab431c28 Isaku Yamahata
#if PIIX_NUM_PIC_IRQS * PIIX_NUM_PIRQS > 64
69 ab431c28 Isaku Yamahata
#error "unable to encode pic state in 64bit in pic_levels."
70 ab431c28 Isaku Yamahata
#endif
71 ab431c28 Isaku Yamahata
    uint64_t pic_levels;
72 ab431c28 Isaku Yamahata
73 bd7dce87 Juan Quintela
    qemu_irq *pic;
74 e735b55a Isaku Yamahata
75 e735b55a Isaku Yamahata
    /* This member isn't used. Just for save/load compatibility */
76 e735b55a Isaku Yamahata
    int32_t pci_irq_levels_vmstate[PIIX_NUM_PIRQS];
77 1ec4ba74 Laszlo Ersek
78 1ec4ba74 Laszlo Ersek
    /* Reset Control Register contents */
79 1ec4ba74 Laszlo Ersek
    uint8_t rcr;
80 1ec4ba74 Laszlo Ersek
81 1ec4ba74 Laszlo Ersek
    /* IO memory region for Reset Control Register (RCR_IOPORT) */
82 1ec4ba74 Laszlo Ersek
    MemoryRegion rcr_mem;
83 7cd9eee0 Gerd Hoffmann
} PIIX3State;
84 bd7dce87 Juan Quintela
85 0a3bacf3 Juan Quintela
struct PCII440FXState {
86 0a3bacf3 Juan Quintela
    PCIDevice dev;
87 ae0a5466 Avi Kivity
    MemoryRegion *system_memory;
88 ae0a5466 Avi Kivity
    MemoryRegion *pci_address_space;
89 ae0a5466 Avi Kivity
    MemoryRegion *ram_memory;
90 ae0a5466 Avi Kivity
    MemoryRegion pci_hole;
91 ae0a5466 Avi Kivity
    MemoryRegion pci_hole_64bit;
92 ae0a5466 Avi Kivity
    PAMMemoryRegion pam_regions[13];
93 ae0a5466 Avi Kivity
    MemoryRegion smram_region;
94 6c009fa4 Juan Quintela
    uint8_t smm_enabled;
95 0a3bacf3 Juan Quintela
};
96 0a3bacf3 Juan Quintela
97 f2c688bb Isaku Yamahata
98 f2c688bb Isaku Yamahata
#define I440FX_PAM      0x59
99 f2c688bb Isaku Yamahata
#define I440FX_PAM_SIZE 7
100 f2c688bb Isaku Yamahata
#define I440FX_SMRAM    0x72
101 f2c688bb Isaku Yamahata
102 ab431c28 Isaku Yamahata
static void piix3_set_irq(void *opaque, int pirq, int level);
103 3afa9bb4 Michael S. Tsirkin
static PCIINTxRoute piix3_route_intx_pin_to_irq(void *opaque, int pci_intx);
104 bf09551a Stefano Stabellini
static void piix3_write_config_xen(PCIDevice *dev,
105 bf09551a Stefano Stabellini
                               uint32_t address, uint32_t val, int len);
106 d2b59317 pbrook
107 d2b59317 pbrook
/* return the global irq number corresponding to a given device irq
108 d2b59317 pbrook
   pin. We could also use the bus number to have a more precise
109 d2b59317 pbrook
   mapping. */
110 ab431c28 Isaku Yamahata
static int pci_slot_get_pirq(PCIDevice *pci_dev, int pci_intx)
111 d2b59317 pbrook
{
112 d2b59317 pbrook
    int slot_addend;
113 d2b59317 pbrook
    slot_addend = (pci_dev->devfn >> 3) - 1;
114 ab431c28 Isaku Yamahata
    return (pci_intx + slot_addend) & 3;
115 d2b59317 pbrook
}
116 502a5395 pbrook
117 0a3bacf3 Juan Quintela
static void i440fx_update_memory_mappings(PCII440FXState *d)
118 ee0ea1d0 bellard
{
119 410edd92 Isaku Yamahata
    int i;
120 84631fd7 bellard
121 72124c01 Avi Kivity
    memory_region_transaction_begin();
122 410edd92 Isaku Yamahata
    for (i = 0; i < 13; i++) {
123 410edd92 Isaku Yamahata
        pam_update(&d->pam_regions[i], i,
124 410edd92 Isaku Yamahata
                   d->dev.config[I440FX_PAM + ((i + 1) / 2)]);
125 ee0ea1d0 bellard
    }
126 410edd92 Isaku Yamahata
    smram_update(&d->smram_region, d->dev.config[I440FX_SMRAM], d->smm_enabled);
127 72124c01 Avi Kivity
    memory_region_transaction_commit();
128 ee0ea1d0 bellard
}
129 ee0ea1d0 bellard
130 f885f1ea Isaku Yamahata
static void i440fx_set_smm(int val, void *arg)
131 ee0ea1d0 bellard
{
132 f885f1ea Isaku Yamahata
    PCII440FXState *d = arg;
133 f885f1ea Isaku Yamahata
134 410edd92 Isaku Yamahata
    memory_region_transaction_begin();
135 410edd92 Isaku Yamahata
    smram_set_smm(&d->smm_enabled, val, d->dev.config[I440FX_SMRAM],
136 410edd92 Isaku Yamahata
                  &d->smram_region);
137 410edd92 Isaku Yamahata
    memory_region_transaction_commit();
138 ee0ea1d0 bellard
}
139 ee0ea1d0 bellard
140 ee0ea1d0 bellard
141 0a3bacf3 Juan Quintela
static void i440fx_write_config(PCIDevice *dev,
142 ee0ea1d0 bellard
                                uint32_t address, uint32_t val, int len)
143 ee0ea1d0 bellard
{
144 0a3bacf3 Juan Quintela
    PCII440FXState *d = DO_UPCAST(PCII440FXState, dev, dev);
145 0a3bacf3 Juan Quintela
146 ee0ea1d0 bellard
    /* XXX: implement SMRAM.D_LOCK */
147 0a3bacf3 Juan Quintela
    pci_default_write_config(dev, address, val, len);
148 4da5fcd3 Isaku Yamahata
    if (ranges_overlap(address, len, I440FX_PAM, I440FX_PAM_SIZE) ||
149 4da5fcd3 Isaku Yamahata
        range_covers_byte(address, len, I440FX_SMRAM)) {
150 ee0ea1d0 bellard
        i440fx_update_memory_mappings(d);
151 4da5fcd3 Isaku Yamahata
    }
152 ee0ea1d0 bellard
}
153 ee0ea1d0 bellard
154 0c7d19e5 Juan Quintela
static int i440fx_load_old(QEMUFile* f, void *opaque, int version_id)
155 ee0ea1d0 bellard
{
156 0a3bacf3 Juan Quintela
    PCII440FXState *d = opaque;
157 52fc1d83 balrog
    int ret, i;
158 ee0ea1d0 bellard
159 0a3bacf3 Juan Quintela
    ret = pci_device_load(&d->dev, f);
160 ee0ea1d0 bellard
    if (ret < 0)
161 ee0ea1d0 bellard
        return ret;
162 ee0ea1d0 bellard
    i440fx_update_memory_mappings(d);
163 6c009fa4 Juan Quintela
    qemu_get_8s(f, &d->smm_enabled);
164 52fc1d83 balrog
165 e735b55a Isaku Yamahata
    if (version_id == 2) {
166 e735b55a Isaku Yamahata
        for (i = 0; i < PIIX_NUM_PIRQS; i++) {
167 e735b55a Isaku Yamahata
            qemu_get_be32(f); /* dummy load for compatibility */
168 e735b55a Isaku Yamahata
        }
169 e735b55a Isaku Yamahata
    }
170 52fc1d83 balrog
171 ee0ea1d0 bellard
    return 0;
172 ee0ea1d0 bellard
}
173 ee0ea1d0 bellard
174 e59fb374 Juan Quintela
static int i440fx_post_load(void *opaque, int version_id)
175 0c7d19e5 Juan Quintela
{
176 0c7d19e5 Juan Quintela
    PCII440FXState *d = opaque;
177 0c7d19e5 Juan Quintela
178 0c7d19e5 Juan Quintela
    i440fx_update_memory_mappings(d);
179 0c7d19e5 Juan Quintela
    return 0;
180 0c7d19e5 Juan Quintela
}
181 0c7d19e5 Juan Quintela
182 0c7d19e5 Juan Quintela
static const VMStateDescription vmstate_i440fx = {
183 0c7d19e5 Juan Quintela
    .name = "I440FX",
184 0c7d19e5 Juan Quintela
    .version_id = 3,
185 0c7d19e5 Juan Quintela
    .minimum_version_id = 3,
186 0c7d19e5 Juan Quintela
    .minimum_version_id_old = 1,
187 0c7d19e5 Juan Quintela
    .load_state_old = i440fx_load_old,
188 752ff2fa Juan Quintela
    .post_load = i440fx_post_load,
189 0c7d19e5 Juan Quintela
    .fields      = (VMStateField []) {
190 0c7d19e5 Juan Quintela
        VMSTATE_PCI_DEVICE(dev, PCII440FXState),
191 0c7d19e5 Juan Quintela
        VMSTATE_UINT8(smm_enabled, PCII440FXState),
192 0c7d19e5 Juan Quintela
        VMSTATE_END_OF_LIST()
193 0c7d19e5 Juan Quintela
    }
194 0c7d19e5 Juan Quintela
};
195 0c7d19e5 Juan Quintela
196 81a322d4 Gerd Hoffmann
static int i440fx_pcihost_initfn(SysBusDevice *dev)
197 502a5395 pbrook
{
198 8558d942 Andreas Färber
    PCIHostState *s = PCI_HOST_BRIDGE(dev);
199 502a5395 pbrook
200 d0ed8076 Avi Kivity
    memory_region_init_io(&s->conf_mem, &pci_host_conf_le_ops, s,
201 d0ed8076 Avi Kivity
                          "pci-conf-idx", 4);
202 d0ed8076 Avi Kivity
    sysbus_add_io(dev, 0xcf8, &s->conf_mem);
203 d0ed8076 Avi Kivity
    sysbus_init_ioports(&s->busdev, 0xcf8, 4);
204 d0ed8076 Avi Kivity
205 d0ed8076 Avi Kivity
    memory_region_init_io(&s->data_mem, &pci_host_data_le_ops, s,
206 d0ed8076 Avi Kivity
                          "pci-conf-data", 4);
207 d0ed8076 Avi Kivity
    sysbus_add_io(dev, 0xcfc, &s->data_mem);
208 d0ed8076 Avi Kivity
    sysbus_init_ioports(&s->busdev, 0xcfc, 4);
209 502a5395 pbrook
210 81a322d4 Gerd Hoffmann
    return 0;
211 8a14daa5 Gerd Hoffmann
}
212 502a5395 pbrook
213 0a3bacf3 Juan Quintela
static int i440fx_initfn(PCIDevice *dev)
214 8a14daa5 Gerd Hoffmann
{
215 0a3bacf3 Juan Quintela
    PCII440FXState *d = DO_UPCAST(PCII440FXState, dev, dev);
216 ee0ea1d0 bellard
217 f2c688bb Isaku Yamahata
    d->dev.config[I440FX_SMRAM] = 0x02;
218 ee0ea1d0 bellard
219 f885f1ea Isaku Yamahata
    cpu_smm_register(&i440fx_set_smm, d);
220 81a322d4 Gerd Hoffmann
    return 0;
221 8a14daa5 Gerd Hoffmann
}
222 8a14daa5 Gerd Hoffmann
223 41445300 Anthony PERARD
static PCIBus *i440fx_common_init(const char *device_name,
224 41445300 Anthony PERARD
                                  PCII440FXState **pi440fx_state,
225 41445300 Anthony PERARD
                                  int *piix3_devfn,
226 60573079 Hervé Poussineau
                                  ISABus **isa_bus, qemu_irq *pic,
227 aee97b84 Avi Kivity
                                  MemoryRegion *address_space_mem,
228 aee97b84 Avi Kivity
                                  MemoryRegion *address_space_io,
229 ae0a5466 Avi Kivity
                                  ram_addr_t ram_size,
230 a8170e5e Avi Kivity
                                  hwaddr pci_hole_start,
231 a8170e5e Avi Kivity
                                  hwaddr pci_hole_size,
232 a8170e5e Avi Kivity
                                  hwaddr pci_hole64_start,
233 a8170e5e Avi Kivity
                                  hwaddr pci_hole64_size,
234 ae0a5466 Avi Kivity
                                  MemoryRegion *pci_address_space,
235 ae0a5466 Avi Kivity
                                  MemoryRegion *ram_memory)
236 8a14daa5 Gerd Hoffmann
{
237 8a14daa5 Gerd Hoffmann
    DeviceState *dev;
238 8a14daa5 Gerd Hoffmann
    PCIBus *b;
239 8a14daa5 Gerd Hoffmann
    PCIDevice *d;
240 8558d942 Andreas Färber
    PCIHostState *s;
241 7cd9eee0 Gerd Hoffmann
    PIIX3State *piix3;
242 ae0a5466 Avi Kivity
    PCII440FXState *f;
243 2725aec7 Avi Kivity
    unsigned i;
244 8a14daa5 Gerd Hoffmann
245 8a14daa5 Gerd Hoffmann
    dev = qdev_create(NULL, "i440FX-pcihost");
246 8558d942 Andreas Färber
    s = PCI_HOST_BRIDGE(dev);
247 aee97b84 Avi Kivity
    s->address_space = address_space_mem;
248 67c332fd Andreas Färber
    b = pci_bus_new(dev, NULL, pci_address_space,
249 aee97b84 Avi Kivity
                    address_space_io, 0);
250 8a14daa5 Gerd Hoffmann
    s->bus = b;
251 f05f6b4a Paolo Bonzini
    object_property_add_child(qdev_get_machine(), "i440fx", OBJECT(dev), NULL);
252 f424d5c4 Paolo Bonzini
    qdev_init_nofail(dev);
253 8a14daa5 Gerd Hoffmann
254 41445300 Anthony PERARD
    d = pci_create_simple(b, 0, device_name);
255 0a3bacf3 Juan Quintela
    *pi440fx_state = DO_UPCAST(PCII440FXState, dev, d);
256 ae0a5466 Avi Kivity
    f = *pi440fx_state;
257 ae0a5466 Avi Kivity
    f->system_memory = address_space_mem;
258 ae0a5466 Avi Kivity
    f->pci_address_space = pci_address_space;
259 ae0a5466 Avi Kivity
    f->ram_memory = ram_memory;
260 ae0a5466 Avi Kivity
    memory_region_init_alias(&f->pci_hole, "pci-hole", f->pci_address_space,
261 ae0a5466 Avi Kivity
                             pci_hole_start, pci_hole_size);
262 ae0a5466 Avi Kivity
    memory_region_add_subregion(f->system_memory, pci_hole_start, &f->pci_hole);
263 ae0a5466 Avi Kivity
    memory_region_init_alias(&f->pci_hole_64bit, "pci-hole64",
264 ae0a5466 Avi Kivity
                             f->pci_address_space,
265 ae0a5466 Avi Kivity
                             pci_hole64_start, pci_hole64_size);
266 ae0a5466 Avi Kivity
    if (pci_hole64_size) {
267 ae0a5466 Avi Kivity
        memory_region_add_subregion(f->system_memory, pci_hole64_start,
268 ae0a5466 Avi Kivity
                                    &f->pci_hole_64bit);
269 ae0a5466 Avi Kivity
    }
270 ae0a5466 Avi Kivity
    memory_region_init_alias(&f->smram_region, "smram-region",
271 ae0a5466 Avi Kivity
                             f->pci_address_space, 0xa0000, 0x20000);
272 b41e1ed4 Avi Kivity
    memory_region_add_subregion_overlap(f->system_memory, 0xa0000,
273 b41e1ed4 Avi Kivity
                                        &f->smram_region, 1);
274 b41e1ed4 Avi Kivity
    memory_region_set_enabled(&f->smram_region, false);
275 410edd92 Isaku Yamahata
    init_pam(f->ram_memory, f->system_memory, f->pci_address_space,
276 410edd92 Isaku Yamahata
             &f->pam_regions[0], PAM_BIOS_BASE, PAM_BIOS_SIZE);
277 2725aec7 Avi Kivity
    for (i = 0; i < 12; ++i) {
278 410edd92 Isaku Yamahata
        init_pam(f->ram_memory, f->system_memory, f->pci_address_space,
279 410edd92 Isaku Yamahata
                 &f->pam_regions[i+1], PAM_EXPAN_BASE + i * PAM_EXPAN_SIZE,
280 410edd92 Isaku Yamahata
                 PAM_EXPAN_SIZE);
281 2725aec7 Avi Kivity
    }
282 8a14daa5 Gerd Hoffmann
283 bf09551a Stefano Stabellini
    /* Xen supports additional interrupt routes from the PCI devices to
284 bf09551a Stefano Stabellini
     * the IOAPIC: the four pins of each PCI device on the bus are also
285 bf09551a Stefano Stabellini
     * connected to the IOAPIC directly.
286 bf09551a Stefano Stabellini
     * These additional routes can be discovered through ACPI. */
287 bf09551a Stefano Stabellini
    if (xen_enabled()) {
288 bf09551a Stefano Stabellini
        piix3 = DO_UPCAST(PIIX3State, dev,
289 bf09551a Stefano Stabellini
                pci_create_simple_multifunction(b, -1, true, "PIIX3-xen"));
290 bf09551a Stefano Stabellini
        pci_bus_irqs(b, xen_piix3_set_irq, xen_pci_slot_get_pirq,
291 bf09551a Stefano Stabellini
                piix3, XEN_PIIX_NUM_PIRQS);
292 bf09551a Stefano Stabellini
    } else {
293 bf09551a Stefano Stabellini
        piix3 = DO_UPCAST(PIIX3State, dev,
294 bf09551a Stefano Stabellini
                pci_create_simple_multifunction(b, -1, true, "PIIX3"));
295 bf09551a Stefano Stabellini
        pci_bus_irqs(b, piix3_set_irq, pci_slot_get_pirq, piix3,
296 bf09551a Stefano Stabellini
                PIIX_NUM_PIRQS);
297 3afa9bb4 Michael S. Tsirkin
        pci_bus_set_route_irq_fn(b, piix3_route_intx_pin_to_irq);
298 bf09551a Stefano Stabellini
    }
299 7cd9eee0 Gerd Hoffmann
    piix3->pic = pic;
300 60573079 Hervé Poussineau
    *isa_bus = DO_UPCAST(ISABus, qbus,
301 60573079 Hervé Poussineau
                         qdev_get_child_bus(&piix3->dev.qdev, "isa.0"));
302 41445300 Anthony PERARD
303 7cd9eee0 Gerd Hoffmann
    *piix3_devfn = piix3->dev.devfn;
304 85a750ca Juan Quintela
305 ec5f92ce Bernhard M. Wiedemann
    ram_size = ram_size / 8 / 1024 / 1024;
306 ec5f92ce Bernhard M. Wiedemann
    if (ram_size > 255)
307 ec5f92ce Bernhard M. Wiedemann
        ram_size = 255;
308 ec5f92ce Bernhard M. Wiedemann
    (*pi440fx_state)->dev.config[0x57]=ram_size;
309 ec5f92ce Bernhard M. Wiedemann
310 ae0a5466 Avi Kivity
    i440fx_update_memory_mappings(f);
311 ae0a5466 Avi Kivity
312 502a5395 pbrook
    return b;
313 502a5395 pbrook
}
314 502a5395 pbrook
315 41445300 Anthony PERARD
PCIBus *i440fx_init(PCII440FXState **pi440fx_state, int *piix3_devfn,
316 60573079 Hervé Poussineau
                    ISABus **isa_bus, qemu_irq *pic,
317 aee97b84 Avi Kivity
                    MemoryRegion *address_space_mem,
318 aee97b84 Avi Kivity
                    MemoryRegion *address_space_io,
319 ae0a5466 Avi Kivity
                    ram_addr_t ram_size,
320 a8170e5e Avi Kivity
                    hwaddr pci_hole_start,
321 a8170e5e Avi Kivity
                    hwaddr pci_hole_size,
322 a8170e5e Avi Kivity
                    hwaddr pci_hole64_start,
323 a8170e5e Avi Kivity
                    hwaddr pci_hole64_size,
324 ae0a5466 Avi Kivity
                    MemoryRegion *pci_memory, MemoryRegion *ram_memory)
325 ae0a5466 Avi Kivity
326 41445300 Anthony PERARD
{
327 41445300 Anthony PERARD
    PCIBus *b;
328 41445300 Anthony PERARD
329 60573079 Hervé Poussineau
    b = i440fx_common_init("i440FX", pi440fx_state, piix3_devfn, isa_bus, pic,
330 ae0a5466 Avi Kivity
                           address_space_mem, address_space_io, ram_size,
331 ae0a5466 Avi Kivity
                           pci_hole_start, pci_hole_size,
332 d50c6c8b Alexey Korolev
                           pci_hole64_start, pci_hole64_size,
333 ae0a5466 Avi Kivity
                           pci_memory, ram_memory);
334 41445300 Anthony PERARD
    return b;
335 41445300 Anthony PERARD
}
336 41445300 Anthony PERARD
337 502a5395 pbrook
/* PIIX3 PCI to ISA bridge */
338 ab431c28 Isaku Yamahata
static void piix3_set_irq_pic(PIIX3State *piix3, int pic_irq)
339 ab431c28 Isaku Yamahata
{
340 ab431c28 Isaku Yamahata
    qemu_set_irq(piix3->pic[pic_irq],
341 ab431c28 Isaku Yamahata
                 !!(piix3->pic_levels &
342 09de0f46 TeLeMan
                    (((1ULL << PIIX_NUM_PIRQS) - 1) <<
343 ab431c28 Isaku Yamahata
                     (pic_irq * PIIX_NUM_PIRQS))));
344 ab431c28 Isaku Yamahata
}
345 502a5395 pbrook
346 afe3ef1d Isaku Yamahata
static void piix3_set_irq_level(PIIX3State *piix3, int pirq, int level)
347 ab431c28 Isaku Yamahata
{
348 ab431c28 Isaku Yamahata
    int pic_irq;
349 ab431c28 Isaku Yamahata
    uint64_t mask;
350 ab431c28 Isaku Yamahata
351 ab431c28 Isaku Yamahata
    pic_irq = piix3->dev.config[PIIX_PIRQC + pirq];
352 ab431c28 Isaku Yamahata
    if (pic_irq >= PIIX_NUM_PIC_IRQS) {
353 ab431c28 Isaku Yamahata
        return;
354 ab431c28 Isaku Yamahata
    }
355 ab431c28 Isaku Yamahata
356 ab431c28 Isaku Yamahata
    mask = 1ULL << ((pic_irq * PIIX_NUM_PIRQS) + pirq);
357 ab431c28 Isaku Yamahata
    piix3->pic_levels &= ~mask;
358 ab431c28 Isaku Yamahata
    piix3->pic_levels |= mask * !!level;
359 ab431c28 Isaku Yamahata
360 afe3ef1d Isaku Yamahata
    piix3_set_irq_pic(piix3, pic_irq);
361 ab431c28 Isaku Yamahata
}
362 ab431c28 Isaku Yamahata
363 ab431c28 Isaku Yamahata
static void piix3_set_irq(void *opaque, int pirq, int level)
364 502a5395 pbrook
{
365 7cd9eee0 Gerd Hoffmann
    PIIX3State *piix3 = opaque;
366 afe3ef1d Isaku Yamahata
    piix3_set_irq_level(piix3, pirq, level);
367 ab431c28 Isaku Yamahata
}
368 502a5395 pbrook
369 3afa9bb4 Michael S. Tsirkin
static PCIINTxRoute piix3_route_intx_pin_to_irq(void *opaque, int pin)
370 3afa9bb4 Michael S. Tsirkin
{
371 3afa9bb4 Michael S. Tsirkin
    PIIX3State *piix3 = opaque;
372 3afa9bb4 Michael S. Tsirkin
    int irq = piix3->dev.config[PIIX_PIRQC + pin];
373 3afa9bb4 Michael S. Tsirkin
    PCIINTxRoute route;
374 3afa9bb4 Michael S. Tsirkin
375 3afa9bb4 Michael S. Tsirkin
    if (irq < PIIX_NUM_PIC_IRQS) {
376 3afa9bb4 Michael S. Tsirkin
        route.mode = PCI_INTX_ENABLED;
377 3afa9bb4 Michael S. Tsirkin
        route.irq = irq;
378 3afa9bb4 Michael S. Tsirkin
    } else {
379 3afa9bb4 Michael S. Tsirkin
        route.mode = PCI_INTX_DISABLED;
380 3afa9bb4 Michael S. Tsirkin
        route.irq = -1;
381 3afa9bb4 Michael S. Tsirkin
    }
382 3afa9bb4 Michael S. Tsirkin
    return route;
383 3afa9bb4 Michael S. Tsirkin
}
384 3afa9bb4 Michael S. Tsirkin
385 ab431c28 Isaku Yamahata
/* irq routing is changed. so rebuild bitmap */
386 ab431c28 Isaku Yamahata
static void piix3_update_irq_levels(PIIX3State *piix3)
387 ab431c28 Isaku Yamahata
{
388 ab431c28 Isaku Yamahata
    int pirq;
389 ab431c28 Isaku Yamahata
390 ab431c28 Isaku Yamahata
    piix3->pic_levels = 0;
391 ab431c28 Isaku Yamahata
    for (pirq = 0; pirq < PIIX_NUM_PIRQS; pirq++) {
392 ab431c28 Isaku Yamahata
        piix3_set_irq_level(piix3, pirq,
393 afe3ef1d Isaku Yamahata
                            pci_bus_get_irq_level(piix3->dev.bus, pirq));
394 ab431c28 Isaku Yamahata
    }
395 ab431c28 Isaku Yamahata
}
396 ab431c28 Isaku Yamahata
397 ab431c28 Isaku Yamahata
static void piix3_write_config(PCIDevice *dev,
398 ab431c28 Isaku Yamahata
                               uint32_t address, uint32_t val, int len)
399 ab431c28 Isaku Yamahata
{
400 ab431c28 Isaku Yamahata
    pci_default_write_config(dev, address, val, len);
401 ab431c28 Isaku Yamahata
    if (ranges_overlap(address, len, PIIX_PIRQC, 4)) {
402 ab431c28 Isaku Yamahata
        PIIX3State *piix3 = DO_UPCAST(PIIX3State, dev, dev);
403 ab431c28 Isaku Yamahata
        int pic_irq;
404 0ae16251 Jan Kiszka
405 0ae16251 Jan Kiszka
        pci_bus_fire_intx_routing_notifier(piix3->dev.bus);
406 ab431c28 Isaku Yamahata
        piix3_update_irq_levels(piix3);
407 ab431c28 Isaku Yamahata
        for (pic_irq = 0; pic_irq < PIIX_NUM_PIC_IRQS; pic_irq++) {
408 ab431c28 Isaku Yamahata
            piix3_set_irq_pic(piix3, pic_irq);
409 d2b59317 pbrook
        }
410 502a5395 pbrook
    }
411 502a5395 pbrook
}
412 502a5395 pbrook
413 bf09551a Stefano Stabellini
static void piix3_write_config_xen(PCIDevice *dev,
414 bf09551a Stefano Stabellini
                               uint32_t address, uint32_t val, int len)
415 bf09551a Stefano Stabellini
{
416 bf09551a Stefano Stabellini
    xen_piix_pci_write_config_client(address, val, len);
417 bf09551a Stefano Stabellini
    piix3_write_config(dev, address, val, len);
418 bf09551a Stefano Stabellini
}
419 bf09551a Stefano Stabellini
420 15a1956a Gleb Natapov
static void piix3_reset(void *opaque)
421 502a5395 pbrook
{
422 fd37d881 Juan Quintela
    PIIX3State *d = opaque;
423 fd37d881 Juan Quintela
    uint8_t *pci_conf = d->dev.config;
424 502a5395 pbrook
425 502a5395 pbrook
    pci_conf[0x04] = 0x07; // master, memory and I/O
426 502a5395 pbrook
    pci_conf[0x05] = 0x00;
427 502a5395 pbrook
    pci_conf[0x06] = 0x00;
428 502a5395 pbrook
    pci_conf[0x07] = 0x02; // PCI_status_devsel_medium
429 502a5395 pbrook
    pci_conf[0x4c] = 0x4d;
430 502a5395 pbrook
    pci_conf[0x4e] = 0x03;
431 502a5395 pbrook
    pci_conf[0x4f] = 0x00;
432 502a5395 pbrook
    pci_conf[0x60] = 0x80;
433 477afee3 aurel32
    pci_conf[0x61] = 0x80;
434 477afee3 aurel32
    pci_conf[0x62] = 0x80;
435 477afee3 aurel32
    pci_conf[0x63] = 0x80;
436 502a5395 pbrook
    pci_conf[0x69] = 0x02;
437 502a5395 pbrook
    pci_conf[0x70] = 0x80;
438 502a5395 pbrook
    pci_conf[0x76] = 0x0c;
439 502a5395 pbrook
    pci_conf[0x77] = 0x0c;
440 502a5395 pbrook
    pci_conf[0x78] = 0x02;
441 502a5395 pbrook
    pci_conf[0x79] = 0x00;
442 502a5395 pbrook
    pci_conf[0x80] = 0x00;
443 502a5395 pbrook
    pci_conf[0x82] = 0x00;
444 502a5395 pbrook
    pci_conf[0xa0] = 0x08;
445 502a5395 pbrook
    pci_conf[0xa2] = 0x00;
446 502a5395 pbrook
    pci_conf[0xa3] = 0x00;
447 502a5395 pbrook
    pci_conf[0xa4] = 0x00;
448 502a5395 pbrook
    pci_conf[0xa5] = 0x00;
449 502a5395 pbrook
    pci_conf[0xa6] = 0x00;
450 502a5395 pbrook
    pci_conf[0xa7] = 0x00;
451 502a5395 pbrook
    pci_conf[0xa8] = 0x0f;
452 502a5395 pbrook
    pci_conf[0xaa] = 0x00;
453 502a5395 pbrook
    pci_conf[0xab] = 0x00;
454 502a5395 pbrook
    pci_conf[0xac] = 0x00;
455 502a5395 pbrook
    pci_conf[0xae] = 0x00;
456 ab431c28 Isaku Yamahata
457 ab431c28 Isaku Yamahata
    d->pic_levels = 0;
458 1ec4ba74 Laszlo Ersek
    d->rcr = 0;
459 ab431c28 Isaku Yamahata
}
460 ab431c28 Isaku Yamahata
461 ab431c28 Isaku Yamahata
static int piix3_post_load(void *opaque, int version_id)
462 ab431c28 Isaku Yamahata
{
463 ab431c28 Isaku Yamahata
    PIIX3State *piix3 = opaque;
464 ab431c28 Isaku Yamahata
    piix3_update_irq_levels(piix3);
465 ab431c28 Isaku Yamahata
    return 0;
466 e735b55a Isaku Yamahata
}
467 15a1956a Gleb Natapov
468 e735b55a Isaku Yamahata
static void piix3_pre_save(void *opaque)
469 e735b55a Isaku Yamahata
{
470 e735b55a Isaku Yamahata
    int i;
471 e735b55a Isaku Yamahata
    PIIX3State *piix3 = opaque;
472 e735b55a Isaku Yamahata
473 e735b55a Isaku Yamahata
    for (i = 0; i < ARRAY_SIZE(piix3->pci_irq_levels_vmstate); i++) {
474 e735b55a Isaku Yamahata
        piix3->pci_irq_levels_vmstate[i] =
475 e735b55a Isaku Yamahata
            pci_bus_get_irq_level(piix3->dev.bus, i);
476 e735b55a Isaku Yamahata
    }
477 502a5395 pbrook
}
478 502a5395 pbrook
479 1ec4ba74 Laszlo Ersek
static bool piix3_rcr_needed(void *opaque)
480 1ec4ba74 Laszlo Ersek
{
481 1ec4ba74 Laszlo Ersek
    PIIX3State *piix3 = opaque;
482 1ec4ba74 Laszlo Ersek
483 1ec4ba74 Laszlo Ersek
    return (piix3->rcr != 0);
484 1ec4ba74 Laszlo Ersek
}
485 1ec4ba74 Laszlo Ersek
486 1ec4ba74 Laszlo Ersek
static const VMStateDescription vmstate_piix3_rcr = {
487 1ec4ba74 Laszlo Ersek
    .name = "PIIX3/rcr",
488 1ec4ba74 Laszlo Ersek
    .version_id = 1,
489 1ec4ba74 Laszlo Ersek
    .minimum_version_id = 1,
490 1ec4ba74 Laszlo Ersek
    .fields = (VMStateField []) {
491 1ec4ba74 Laszlo Ersek
        VMSTATE_UINT8(rcr, PIIX3State),
492 1ec4ba74 Laszlo Ersek
        VMSTATE_END_OF_LIST()
493 1ec4ba74 Laszlo Ersek
    }
494 1ec4ba74 Laszlo Ersek
};
495 1ec4ba74 Laszlo Ersek
496 d1f171bd Juan Quintela
static const VMStateDescription vmstate_piix3 = {
497 d1f171bd Juan Quintela
    .name = "PIIX3",
498 d1f171bd Juan Quintela
    .version_id = 3,
499 d1f171bd Juan Quintela
    .minimum_version_id = 2,
500 d1f171bd Juan Quintela
    .minimum_version_id_old = 2,
501 ab431c28 Isaku Yamahata
    .post_load = piix3_post_load,
502 e735b55a Isaku Yamahata
    .pre_save = piix3_pre_save,
503 1ec4ba74 Laszlo Ersek
    .fields      = (VMStateField[]) {
504 d1f171bd Juan Quintela
        VMSTATE_PCI_DEVICE(dev, PIIX3State),
505 e735b55a Isaku Yamahata
        VMSTATE_INT32_ARRAY_V(pci_irq_levels_vmstate, PIIX3State,
506 e735b55a Isaku Yamahata
                              PIIX_NUM_PIRQS, 3),
507 d1f171bd Juan Quintela
        VMSTATE_END_OF_LIST()
508 1ec4ba74 Laszlo Ersek
    },
509 1ec4ba74 Laszlo Ersek
    .subsections = (VMStateSubsection[]) {
510 1ec4ba74 Laszlo Ersek
        {
511 1ec4ba74 Laszlo Ersek
            .vmsd = &vmstate_piix3_rcr,
512 1ec4ba74 Laszlo Ersek
            .needed = piix3_rcr_needed,
513 1ec4ba74 Laszlo Ersek
        },
514 1ec4ba74 Laszlo Ersek
        { 0 }
515 1ec4ba74 Laszlo Ersek
    }
516 1ec4ba74 Laszlo Ersek
};
517 1ec4ba74 Laszlo Ersek
518 1ec4ba74 Laszlo Ersek
519 1ec4ba74 Laszlo Ersek
static void rcr_write(void *opaque, hwaddr addr, uint64_t val, unsigned len)
520 1ec4ba74 Laszlo Ersek
{
521 1ec4ba74 Laszlo Ersek
    PIIX3State *d = opaque;
522 1ec4ba74 Laszlo Ersek
523 1ec4ba74 Laszlo Ersek
    if (val & 4) {
524 1ec4ba74 Laszlo Ersek
        qemu_system_reset_request();
525 1ec4ba74 Laszlo Ersek
        return;
526 da64182c Juan Quintela
    }
527 1ec4ba74 Laszlo Ersek
    d->rcr = val & 2; /* keep System Reset type only */
528 1ec4ba74 Laszlo Ersek
}
529 1ec4ba74 Laszlo Ersek
530 1ec4ba74 Laszlo Ersek
static uint64_t rcr_read(void *opaque, hwaddr addr, unsigned len)
531 1ec4ba74 Laszlo Ersek
{
532 1ec4ba74 Laszlo Ersek
    PIIX3State *d = opaque;
533 1ec4ba74 Laszlo Ersek
534 1ec4ba74 Laszlo Ersek
    return d->rcr;
535 1ec4ba74 Laszlo Ersek
}
536 1ec4ba74 Laszlo Ersek
537 1ec4ba74 Laszlo Ersek
static const MemoryRegionOps rcr_ops = {
538 1ec4ba74 Laszlo Ersek
    .read = rcr_read,
539 1ec4ba74 Laszlo Ersek
    .write = rcr_write,
540 1ec4ba74 Laszlo Ersek
    .endianness = DEVICE_LITTLE_ENDIAN
541 d1f171bd Juan Quintela
};
542 1941d19c bellard
543 fd37d881 Juan Quintela
static int piix3_initfn(PCIDevice *dev)
544 502a5395 pbrook
{
545 fd37d881 Juan Quintela
    PIIX3State *d = DO_UPCAST(PIIX3State, dev, dev);
546 502a5395 pbrook
547 c2d0d012 Richard Henderson
    isa_bus_new(&d->dev.qdev, pci_address_space_io(dev));
548 1ec4ba74 Laszlo Ersek
549 1ec4ba74 Laszlo Ersek
    memory_region_init_io(&d->rcr_mem, &rcr_ops, d, "piix3-reset-control", 1);
550 1ec4ba74 Laszlo Ersek
    memory_region_add_subregion_overlap(pci_address_space_io(dev), RCR_IOPORT,
551 1ec4ba74 Laszlo Ersek
                                        &d->rcr_mem, 1);
552 1ec4ba74 Laszlo Ersek
553 a08d4367 Jan Kiszka
    qemu_register_reset(piix3_reset, d);
554 81a322d4 Gerd Hoffmann
    return 0;
555 502a5395 pbrook
}
556 5c2b87e3 ths
557 40021f08 Anthony Liguori
static void piix3_class_init(ObjectClass *klass, void *data)
558 40021f08 Anthony Liguori
{
559 39bffca2 Anthony Liguori
    DeviceClass *dc = DEVICE_CLASS(klass);
560 40021f08 Anthony Liguori
    PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
561 40021f08 Anthony Liguori
562 39bffca2 Anthony Liguori
    dc->desc        = "ISA bridge";
563 39bffca2 Anthony Liguori
    dc->vmsd        = &vmstate_piix3;
564 39bffca2 Anthony Liguori
    dc->no_user     = 1,
565 40021f08 Anthony Liguori
    k->no_hotplug   = 1;
566 40021f08 Anthony Liguori
    k->init         = piix3_initfn;
567 40021f08 Anthony Liguori
    k->config_write = piix3_write_config;
568 40021f08 Anthony Liguori
    k->vendor_id    = PCI_VENDOR_ID_INTEL;
569 40021f08 Anthony Liguori
    k->device_id    = PCI_DEVICE_ID_INTEL_82371SB_0; // 82371SB PIIX3 PCI-to-ISA bridge (Step A1)
570 40021f08 Anthony Liguori
    k->class_id     = PCI_CLASS_BRIDGE_ISA;
571 40021f08 Anthony Liguori
}
572 40021f08 Anthony Liguori
573 4240abff Andreas Färber
static const TypeInfo piix3_info = {
574 39bffca2 Anthony Liguori
    .name          = "PIIX3",
575 39bffca2 Anthony Liguori
    .parent        = TYPE_PCI_DEVICE,
576 39bffca2 Anthony Liguori
    .instance_size = sizeof(PIIX3State),
577 39bffca2 Anthony Liguori
    .class_init    = piix3_class_init,
578 e855761c Anthony Liguori
};
579 e855761c Anthony Liguori
580 40021f08 Anthony Liguori
static void piix3_xen_class_init(ObjectClass *klass, void *data)
581 40021f08 Anthony Liguori
{
582 39bffca2 Anthony Liguori
    DeviceClass *dc = DEVICE_CLASS(klass);
583 40021f08 Anthony Liguori
    PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
584 40021f08 Anthony Liguori
585 39bffca2 Anthony Liguori
    dc->desc        = "ISA bridge";
586 39bffca2 Anthony Liguori
    dc->vmsd        = &vmstate_piix3;
587 39bffca2 Anthony Liguori
    dc->no_user     = 1;
588 40021f08 Anthony Liguori
    k->no_hotplug   = 1;
589 40021f08 Anthony Liguori
    k->init         = piix3_initfn;
590 40021f08 Anthony Liguori
    k->config_write = piix3_write_config_xen;
591 40021f08 Anthony Liguori
    k->vendor_id    = PCI_VENDOR_ID_INTEL;
592 40021f08 Anthony Liguori
    k->device_id    = PCI_DEVICE_ID_INTEL_82371SB_0; // 82371SB PIIX3 PCI-to-ISA bridge (Step A1)
593 40021f08 Anthony Liguori
    k->class_id     = PCI_CLASS_BRIDGE_ISA;
594 e855761c Anthony Liguori
};
595 e855761c Anthony Liguori
596 4240abff Andreas Färber
static const TypeInfo piix3_xen_info = {
597 39bffca2 Anthony Liguori
    .name          = "PIIX3-xen",
598 39bffca2 Anthony Liguori
    .parent        = TYPE_PCI_DEVICE,
599 39bffca2 Anthony Liguori
    .instance_size = sizeof(PIIX3State),
600 39bffca2 Anthony Liguori
    .class_init    = piix3_xen_class_init,
601 40021f08 Anthony Liguori
};
602 40021f08 Anthony Liguori
603 40021f08 Anthony Liguori
static void i440fx_class_init(ObjectClass *klass, void *data)
604 40021f08 Anthony Liguori
{
605 39bffca2 Anthony Liguori
    DeviceClass *dc = DEVICE_CLASS(klass);
606 40021f08 Anthony Liguori
    PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
607 40021f08 Anthony Liguori
608 40021f08 Anthony Liguori
    k->no_hotplug = 1;
609 40021f08 Anthony Liguori
    k->init = i440fx_initfn;
610 40021f08 Anthony Liguori
    k->config_write = i440fx_write_config;
611 40021f08 Anthony Liguori
    k->vendor_id = PCI_VENDOR_ID_INTEL;
612 40021f08 Anthony Liguori
    k->device_id = PCI_DEVICE_ID_INTEL_82441;
613 40021f08 Anthony Liguori
    k->revision = 0x02;
614 40021f08 Anthony Liguori
    k->class_id = PCI_CLASS_BRIDGE_HOST;
615 39bffca2 Anthony Liguori
    dc->desc = "Host bridge";
616 39bffca2 Anthony Liguori
    dc->no_user = 1;
617 39bffca2 Anthony Liguori
    dc->vmsd = &vmstate_i440fx;
618 40021f08 Anthony Liguori
}
619 40021f08 Anthony Liguori
620 4240abff Andreas Färber
static const TypeInfo i440fx_info = {
621 39bffca2 Anthony Liguori
    .name          = "i440FX",
622 39bffca2 Anthony Liguori
    .parent        = TYPE_PCI_DEVICE,
623 39bffca2 Anthony Liguori
    .instance_size = sizeof(PCII440FXState),
624 39bffca2 Anthony Liguori
    .class_init    = i440fx_class_init,
625 8a14daa5 Gerd Hoffmann
};
626 8a14daa5 Gerd Hoffmann
627 999e12bb Anthony Liguori
static void i440fx_pcihost_class_init(ObjectClass *klass, void *data)
628 999e12bb Anthony Liguori
{
629 39bffca2 Anthony Liguori
    DeviceClass *dc = DEVICE_CLASS(klass);
630 999e12bb Anthony Liguori
    SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
631 999e12bb Anthony Liguori
632 999e12bb Anthony Liguori
    k->init = i440fx_pcihost_initfn;
633 39bffca2 Anthony Liguori
    dc->fw_name = "pci";
634 39bffca2 Anthony Liguori
    dc->no_user = 1;
635 999e12bb Anthony Liguori
}
636 999e12bb Anthony Liguori
637 4240abff Andreas Färber
static const TypeInfo i440fx_pcihost_info = {
638 39bffca2 Anthony Liguori
    .name          = "i440FX-pcihost",
639 8558d942 Andreas Färber
    .parent        = TYPE_PCI_HOST_BRIDGE,
640 39bffca2 Anthony Liguori
    .instance_size = sizeof(I440FXState),
641 39bffca2 Anthony Liguori
    .class_init    = i440fx_pcihost_class_init,
642 8a14daa5 Gerd Hoffmann
};
643 8a14daa5 Gerd Hoffmann
644 83f7d43a Andreas Färber
static void i440fx_register_types(void)
645 8a14daa5 Gerd Hoffmann
{
646 39bffca2 Anthony Liguori
    type_register_static(&i440fx_info);
647 39bffca2 Anthony Liguori
    type_register_static(&piix3_info);
648 39bffca2 Anthony Liguori
    type_register_static(&piix3_xen_info);
649 39bffca2 Anthony Liguori
    type_register_static(&i440fx_pcihost_info);
650 8a14daa5 Gerd Hoffmann
}
651 83f7d43a Andreas Färber
652 83f7d43a Andreas Färber
type_init(i440fx_register_types)