Revision 006f3a48 hw/ppc_newworld.c

b/hw/ppc_newworld.c
32 32
#include "net.h"
33 33
#include "sysemu.h"
34 34
#include "boards.h"
35
#include "fw_cfg.h"
35 36
#include "escc.h"
36 37

  
37 38
#define MAX_IDE_BUS 2
38 39
#define VGA_BIOS_SIZE 65536
40
#define CFG_ADDR 0xf0000510
39 41

  
40 42
/* debug UniNorth */
41 43
//#define DEBUG_UNIN
......
103 105
    int ppc_boot_device;
104 106
    int index;
105 107
    BlockDriverState *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
108
    void *fw_cfg;
106 109
    void *dbdma;
107 110

  
108 111
    linux_boot = (kernel_filename != NULL);
......
135 138
    /* allocate and load BIOS */
136 139
    bios_offset = qemu_ram_alloc(BIOS_SIZE);
137 140
    if (bios_name == NULL)
138
        bios_name = BIOS_FILENAME;
141
        bios_name = PROM_FILENAME;
139 142
    snprintf(buf, sizeof(buf), "%s/%s", bios_dir, bios_name);
140
    bios_size = load_image(buf, phys_ram_base + bios_offset);
143
    cpu_register_physical_memory(PROM_ADDR, BIOS_SIZE, bios_offset | IO_MEM_ROM);
144

  
145
    /* Load OpenBIOS (ELF) */
146
    bios_size = load_elf(buf, 0, NULL, NULL, NULL);
141 147
    if (bios_size < 0 || bios_size > BIOS_SIZE) {
142 148
        cpu_abort(env, "qemu: could not load PowerPC bios '%s'\n", buf);
143 149
        exit(1);
144 150
    }
145
    bios_size = (bios_size + 0xfff) & ~0xfff;
146
    if (bios_size > 0x00080000) {
147
        /* As the NVRAM is located at 0xFFF04000, we cannot use 1 MB BIOSes */
148
        cpu_abort(env, "Mac99 hardware can not handle 1 MB BIOS\n");
149
    }
150
    cpu_register_physical_memory((uint32_t)(-bios_size),
151
                                 bios_size, bios_offset | IO_MEM_ROM);
152 151

  
153 152
    /* allocate and load VGA BIOS */
154 153
    vga_bios_offset = qemu_ram_alloc(VGA_BIOS_SIZE);
......
337 336
                         graphic_width, graphic_height, graphic_depth);
338 337
    /* No PCI init: the BIOS will do it */
339 338

  
340
    /* Special port to get debug messages from Open-Firmware */
341
    register_ioport_write(0x0F00, 4, 1, &PPC_debug_write, NULL);
339
    fw_cfg = fw_cfg_init(0, 0, CFG_ADDR, CFG_ADDR + 2);
340
    fw_cfg_add_i32(fw_cfg, FW_CFG_ID, 1);
341
    fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, (uint64_t)ram_size);
342
    fw_cfg_add_i16(fw_cfg, FW_CFG_MACHINE_ID, ARCH_MAC99);
342 343
}
343 344

  
344 345
QEMUMachine core99_machine = {

Also available in: Unified diff