Revision ae0bfb79 hw/ppc_newworld.c

b/hw/ppc_newworld.c
69 69
#include "blockdev.h"
70 70

  
71 71
#define MAX_IDE_BUS 2
72
#define VGA_BIOS_SIZE 65536
73 72
#define CFG_ADDR 0xf0000510
74 73

  
75 74
/* debug UniNorth */
......
134 133
    qemu_irq *pic, **openpic_irqs;
135 134
    int unin_memory;
136 135
    int linux_boot, i;
137
    ram_addr_t ram_offset, bios_offset, vga_bios_offset;
136
    ram_addr_t ram_offset, bios_offset;
138 137
    uint32_t kernel_base, initrd_base;
139 138
    long kernel_size, initrd_size;
140 139
    PCIBus *pci_bus;
141 140
    MacIONVRAMState *nvr;
142 141
    int nvram_mem_index;
143
    int vga_bios_size, bios_size;
142
    int bios_size;
144 143
    int pic_mem_index, dbdma_mem_index, cuda_mem_index, escc_mem_index;
145 144
    int ide_mem_index[3];
146 145
    int ppc_boot_device;
147 146
    DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
148 147
    void *fw_cfg;
149 148
    void *dbdma;
150
    uint8_t *vga_bios_ptr;
151 149
    int machine_arch;
152 150

  
153 151
    linux_boot = (kernel_filename != NULL);
......
167 165
        }
168 166
        /* Set time-base frequency to 100 Mhz */
169 167
        cpu_ppc_tb_init(env, 100UL * 1000UL * 1000UL);
170
#if 0
171
        env->osi_call = vga_osi_call;
172
#endif
173 168
        qemu_register_reset((QEMUResetHandler*)&cpu_reset, env);
174 169
        envs[i] = env;
175 170
    }
......
199 194
        exit(1);
200 195
    }
201 196

  
202
    /* allocate and load VGA BIOS */
203
    vga_bios_offset = qemu_ram_alloc(NULL, "ppc_core99.vbios", VGA_BIOS_SIZE);
204
    vga_bios_ptr = qemu_get_ram_ptr(vga_bios_offset);
205
    filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, VGABIOS_FILENAME);
206
    if (filename) {
207
        vga_bios_size = load_image(filename, vga_bios_ptr + 8);
208
        qemu_free(filename);
209
    } else {
210
        vga_bios_size = -1;
211
    }
212
    if (vga_bios_size < 0) {
213
        /* if no bios is present, we can still work */
214
        fprintf(stderr, "qemu: warning: could not load VGA bios '%s'\n",
215
                VGABIOS_FILENAME);
216
        vga_bios_size = 0;
217
    } else {
218
        /* set a specific header (XXX: find real Apple format for NDRV
219
           drivers) */
220
        vga_bios_ptr[0] = 'N';
221
        vga_bios_ptr[1] = 'D';
222
        vga_bios_ptr[2] = 'R';
223
        vga_bios_ptr[3] = 'V';
224
        cpu_to_be32w((uint32_t *)(vga_bios_ptr + 4), vga_bios_size);
225
        vga_bios_size += 8;
226

  
227
        /* Round to page boundary */
228
        vga_bios_size = (vga_bios_size + TARGET_PAGE_SIZE - 1) &
229
            TARGET_PAGE_MASK;
230
    }
231

  
232 197
    if (linux_boot) {
233 198
        uint64_t lowaddr = 0;
234 199
        int bswap_needed;
......
352 317
        machine_arch = ARCH_MAC99;
353 318
    }
354 319
    /* init basic PC hardware */
355
    pci_vga_init(pci_bus, vga_bios_offset, vga_bios_size);
320
    pci_vga_init(pci_bus, 0, 0);
356 321

  
357 322
    escc_mem_index = escc_init(0x80013000, pic[0x25], pic[0x24],
358 323
                               serial_hds[0], serial_hds[1], ESCC_CLOCK, 4);

Also available in: Unified diff