Revision fd37d881

b/hw/piix_pci.c
33 33

  
34 34
typedef PCIHostState I440FXState;
35 35

  
36
typedef struct PIIX3State {
37
    PCIDevice dev;
38
} PIIX3State;
39

  
36 40
struct PCII440FXState {
37 41
    PCIDevice dev;
38 42
    target_phys_addr_t isa_page_descs[384 / 4];
......
231 235

  
232 236
/* PIIX3 PCI to ISA bridge */
233 237

  
234
static PCIDevice *piix3_dev;
238
static PIIX3State *piix3_dev;
235 239

  
236 240
static void piix3_set_irq(void *opaque, int irq_num, int level)
237 241
{
......
242 246

  
243 247
    /* now we change the pic irq level according to the piix irq mappings */
244 248
    /* XXX: optimize */
245
    pic_irq = piix3_dev->config[0x60 + irq_num];
249
    pic_irq = piix3_dev->dev.config[0x60 + irq_num];
246 250
    if (pic_irq < 16) {
247 251
        /* The pic level is the logical OR of all the PCI irqs mapped
248 252
           to it */
249 253
        pic_level = 0;
250 254
        for (i = 0; i < 4; i++) {
251
            if (pic_irq == piix3_dev->config[0x60 + i])
255
            if (pic_irq == piix3_dev->dev.config[0x60 + i])
252 256
                pic_level |= pci_irq_levels[i];
253 257
        }
254 258
        qemu_set_irq(pic[pic_irq], pic_level);
......
257 261

  
258 262
static void piix3_reset(void *opaque)
259 263
{
260
    PCIDevice *d = opaque;
261
    uint8_t *pci_conf = d->config;
264
    PIIX3State *d = opaque;
265
    uint8_t *pci_conf = d->dev.config;
262 266

  
263 267
    pci_conf[0x04] = 0x07; // master, memory and I/O
264 268
    pci_conf[0x05] = 0x00;
......
309 313
    return pci_device_load(d, f);
310 314
}
311 315

  
312
static int piix3_initfn(PCIDevice *d)
316
static int piix3_initfn(PCIDevice *dev)
313 317
{
318
    PIIX3State *d = DO_UPCAST(PIIX3State, dev, dev);
314 319
    uint8_t *pci_conf;
315 320

  
316
    isa_bus_new(&d->qdev);
321
    isa_bus_new(&d->dev.qdev);
317 322
    register_savevm("PIIX3", 0, 2, piix_save, piix_load, d);
318 323

  
319
    pci_conf = d->config;
324
    pci_conf = d->dev.config;
320 325
    pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_INTEL);
321 326
    pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_INTEL_82371SB_0); // 82371SB PIIX3 PCI-to-ISA bridge (Step A1)
322 327
    pci_config_set_class(pci_conf, PCI_CLASS_BRIDGE_ISA);
......
348 353
    },{
349 354
        .qdev.name    = "PIIX3",
350 355
        .qdev.desc    = "ISA bridge",
351
        .qdev.size    = sizeof(PCIDevice),
356
        .qdev.size    = sizeof(PIIX3State),
352 357
        .qdev.no_user = 1,
353 358
        .init         = piix3_initfn,
354 359
    },{

Also available in: Unified diff