static int pci_cirrus_vga_initfn(PCIDevice *dev)

{

     PCICirrusVGAState *d = DO_UPCAST(PCICirrusVGAState, dev, dev);

     CirrusVGAState *s = &d->cirrus_vga;

     PCIDeviceClass *pc = PCI_DEVICE_GET_CLASS(dev);

     int16_t device_id = pc->device_id;



     /* setup VGA */

     vga_common_init(&s->vga);

     cirrus_init_common(s, device_id, 1, pci_address_space(dev),

                        pci_address_space_io(dev));

     s->vga.con = graphic_console_init(s->vga.update, s->vga.invalidate,

                                       s->vga.screen_dump, s->vga.text_update,

                                       &s->vga);



     /* setup PCI */



    memory_region_init(&s->pci_bar, "cirrus-pci-bar0", 0x2000000);



    /* XXX: add byte swapping apertures */

    memory_region_add_subregion(&s->pci_bar, 0, &s->cirrus_linear_io);

    memory_region_add_subregion(&s->pci_bar, 0x1000000,

                                &s->cirrus_linear_bitblt_io);



     /* setup memory space */

     /* memory #0 LFB */

     /* memory #1 memory-mapped I/O */

     /* XXX: s->vga.vram_size must be a power of two */

     pci_register_bar(&d->dev, 0, PCI_BASE_ADDRESS_MEM_PREFETCH, &s->pci_bar);

     if (device_id == CIRRUS_ID_CLGD5446) {

         pci_register_bar(&d->dev, 1, 0, &s->cirrus_mmio_io);

     }

     return 0;

}

static int pci_cirrus_vga_initfn(PCIDevice *dev)

{

     PCICirrusVGAState *d = DO_UPCAST(PCICirrusVGAState, dev, dev);

     CirrusVGAState *s = &d->cirrus_vga;

     PCIDeviceClass *pc = PCI_DEVICE_GET_CLASS(dev);

     int16_t device_id = pc->device_id;



     

     vga_common_init(&s->vga);

     cirrus_init_common(s, device_id, 1, pci_address_space(dev),

                        pci_address_space_io(dev));

     s->vga.con = graphic_console_init(s->vga.update, s->vga.invalidate,

                                       s->vga.screen_dump, s->vga.text_update,

                                       &s->vga);



     



    memory_region_init(&s->pci_bar, "cirrus-pci-bar0", 0x2000000);



    

    memory_region_add_subregion(&s->pci_bar, 0, &s->cirrus_linear_io);

    memory_region_add_subregion(&s->pci_bar, 0x1000000,

                                &s->cirrus_linear_bitblt_io);



     

     

     

     

     pci_register_bar(&d->dev, 0, PCI_BASE_ADDRESS_MEM_PREFETCH, &s->pci_bar);

     if (device_id == CIRRUS_ID_CLGD5446) {

         pci_register_bar(&d->dev, 1, 0, &s->cirrus_mmio_io);

     }

     return 0;

}

static int FUNC_0(PCIDevice *VAR_0)

{

     PCICirrusVGAState *d = DO_UPCAST(PCICirrusVGAState, VAR_0, VAR_0);

     CirrusVGAState *s = &d->cirrus_vga;

     PCIDeviceClass *pc = PCI_DEVICE_GET_CLASS(VAR_0);

     int16_t device_id = pc->device_id;



     

     vga_common_init(&s->vga);

     cirrus_init_common(s, device_id, 1, pci_address_space(VAR_0),

                        pci_address_space_io(VAR_0));

     s->vga.con = graphic_console_init(s->vga.update, s->vga.invalidate,

                                       s->vga.screen_dump, s->vga.text_update,

                                       &s->vga);



     



    memory_region_init(&s->pci_bar, "cirrus-pci-bar0", 0x2000000);



    

    memory_region_add_subregion(&s->pci_bar, 0, &s->cirrus_linear_io);

    memory_region_add_subregion(&s->pci_bar, 0x1000000,

                                &s->cirrus_linear_bitblt_io);



     

     

     

     

     pci_register_bar(&d->VAR_0, 0, PCI_BASE_ADDRESS_MEM_PREFETCH, &s->pci_bar);

     if (device_id == CIRRUS_ID_CLGD5446) {

         pci_register_bar(&d->VAR_0, 1, 0, &s->cirrus_mmio_io);

     }

     return 0;

}

static int FUNC_0(PCIDevice *VAR_0)
{ PCICirrusVGAState *d = DO_UPCAST(PCICirrusVGAState, VAR_0, VAR_0); CirrusVGAState *s = &d->cirrus_vga; PCIDeviceClass *pc = PCI_DEVICE_GET_CLASS(VAR_0); int16_t device_id = pc->device_id; vga_common_init(&s->vga); cirrus_init_common(s, device_id, 1, pci_address_space(VAR_0),
pci_address_space_io(VAR_0)); s->vga.con = graphic_console_init(s->vga.update, s->vga.invalidate,
s->vga.screen_dump, s->vga.text_update,
&s->vga); memory_region_init(&s->pci_bar, "cirrus-pci-bar0", 0x2000000); memory_region_add_subregion(&s->pci_bar, 0, &s->cirrus_linear_io); memory_region_add_subregion(&s->pci_bar, 0x1000000,
&s->cirrus_linear_bitblt_io); pci_register_bar(&d->VAR_0, 0, PCI_BASE_ADDRESS_MEM_PREFETCH, &s->pci_bar); if (device_id == CIRRUS_ID_CLGD5446) { pci_register_bar(&d->VAR_0, 1, 0, &s->cirrus_mmio_io); } return 0; }