Revision 78895427 hw/vga-pci.c

b/hw/vga-pci.c
52 52
{
53 53
    PCIVGAState *d = (PCIVGAState *)pci_dev;
54 54
    VGACommonState *s = &d->vga;
55
    if (region_num == PCI_ROM_SLOT) {
56
        cpu_register_physical_memory(addr, s->bios_size, s->bios_offset);
57
    } else {
58
        cpu_register_physical_memory(addr, s->vram_size, s->vram_offset);
59
        s->map_addr = addr;
60
        s->map_end = addr + s->vram_size;
61
        vga_dirty_log_start(s);
62
    }
55

  
56
    cpu_register_physical_memory(addr, s->vram_size, s->vram_offset);
57
    s->map_addr = addr;
58
    s->map_end = addr + s->vram_size;
59
    vga_dirty_log_start(s);
63 60
}
64 61

  
65 62
static void pci_vga_write_config(PCIDevice *d,
......
95 92
     pci_register_bar(&d->dev, 0, VGA_RAM_SIZE,
96 93
                      PCI_BASE_ADDRESS_MEM_PREFETCH, vga_map);
97 94

  
98
     if (s->bios_size) {
99
        unsigned int bios_total_size;
100
        /* must be a power of two */
101
        bios_total_size = 1;
102
        while (bios_total_size < s->bios_size)
103
            bios_total_size <<= 1;
104
        pci_register_bar(&d->dev, PCI_ROM_SLOT, bios_total_size,
105
                         PCI_BASE_ADDRESS_MEM_PREFETCH, vga_map);
106
     } else {
107
         if (dev->romfile == NULL)
108
             dev->romfile = qemu_strdup("vgabios-stdvga.bin");
109
     }
110 95
     return 0;
111 96
}
112 97

  
113
int pci_vga_init(PCIBus *bus,
114
                 unsigned long vga_bios_offset, int vga_bios_size)
98
int pci_vga_init(PCIBus *bus)
115 99
{
116
    PCIDevice *dev;
117

  
118
    dev = pci_create(bus, -1, "VGA");
119
    qdev_prop_set_uint32(&dev->qdev, "bios-offset", vga_bios_offset);
120
    qdev_prop_set_uint32(&dev->qdev, "bios-size", vga_bios_size);
121
    qdev_init_nofail(&dev->qdev);
122

  
100
    pci_create_simple(bus, -1, "VGA");
123 101
    return 0;
124 102
}
125 103

  
......
129 107
    .qdev.vmsd    = &vmstate_vga_pci,
130 108
    .init         = pci_vga_initfn,
131 109
    .config_write = pci_vga_write_config,
132
    .qdev.props   = (Property[]) {
133
        DEFINE_PROP_HEX32("bios-offset", PCIVGAState, vga.bios_offset, 0),
134
        DEFINE_PROP_HEX32("bios-size",   PCIVGAState, vga.bios_size,   0),
135
        DEFINE_PROP_END_OF_LIST(),
136
    }
110
    .romfile      = "vgabios-stdvga.bin",
137 111
};
138 112

  
139 113
static void vga_register(void)

Also available in: Unified diff