Commit 006f3a48e0793caae62c002636c9cd0c5334ae24

Authored by blueswir1
1 parent aa71cf80

Switch Mac99 to OpenBIOS

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6560 c046a42c-6fe2-441c-8c8c-71466251a162
hw/ppc_newworld.c
@@ -32,10 +32,12 @@ @@ -32,10 +32,12 @@
32 #include "net.h" 32 #include "net.h"
33 #include "sysemu.h" 33 #include "sysemu.h"
34 #include "boards.h" 34 #include "boards.h"
  35 +#include "fw_cfg.h"
35 #include "escc.h" 36 #include "escc.h"
36 37
37 #define MAX_IDE_BUS 2 38 #define MAX_IDE_BUS 2
38 #define VGA_BIOS_SIZE 65536 39 #define VGA_BIOS_SIZE 65536
  40 +#define CFG_ADDR 0xf0000510
39 41
40 /* debug UniNorth */ 42 /* debug UniNorth */
41 //#define DEBUG_UNIN 43 //#define DEBUG_UNIN
@@ -103,6 +105,7 @@ static void ppc_core99_init (ram_addr_t ram_size, int vga_ram_size, @@ -103,6 +105,7 @@ static void ppc_core99_init (ram_addr_t ram_size, int vga_ram_size,
103 int ppc_boot_device; 105 int ppc_boot_device;
104 int index; 106 int index;
105 BlockDriverState *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; 107 BlockDriverState *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
  108 + void *fw_cfg;
106 void *dbdma; 109 void *dbdma;
107 110
108 linux_boot = (kernel_filename != NULL); 111 linux_boot = (kernel_filename != NULL);
@@ -135,20 +138,16 @@ static void ppc_core99_init (ram_addr_t ram_size, int vga_ram_size, @@ -135,20 +138,16 @@ static void ppc_core99_init (ram_addr_t ram_size, int vga_ram_size,
135 /* allocate and load BIOS */ 138 /* allocate and load BIOS */
136 bios_offset = qemu_ram_alloc(BIOS_SIZE); 139 bios_offset = qemu_ram_alloc(BIOS_SIZE);
137 if (bios_name == NULL) 140 if (bios_name == NULL)
138 - bios_name = BIOS_FILENAME; 141 + bios_name = PROM_FILENAME;
139 snprintf(buf, sizeof(buf), "%s/%s", bios_dir, bios_name); 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 if (bios_size < 0 || bios_size > BIOS_SIZE) { 147 if (bios_size < 0 || bios_size > BIOS_SIZE) {
142 cpu_abort(env, "qemu: could not load PowerPC bios '%s'\n", buf); 148 cpu_abort(env, "qemu: could not load PowerPC bios '%s'\n", buf);
143 exit(1); 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 /* allocate and load VGA BIOS */ 152 /* allocate and load VGA BIOS */
154 vga_bios_offset = qemu_ram_alloc(VGA_BIOS_SIZE); 153 vga_bios_offset = qemu_ram_alloc(VGA_BIOS_SIZE);
@@ -337,8 +336,10 @@ static void ppc_core99_init (ram_addr_t ram_size, int vga_ram_size, @@ -337,8 +336,10 @@ static void ppc_core99_init (ram_addr_t ram_size, int vga_ram_size,
337 graphic_width, graphic_height, graphic_depth); 336 graphic_width, graphic_height, graphic_depth);
338 /* No PCI init: the BIOS will do it */ 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 QEMUMachine core99_machine = { 345 QEMUMachine core99_machine = {
pc-bios/README
@@ -42,7 +42,7 @@ @@ -42,7 +42,7 @@
42 firmware implementation. The goal is to implement a 100% IEEE 42 firmware implementation. The goal is to implement a 100% IEEE
43 1275-1994 (referred to as Open Firmware) compliant firmware. 43 1275-1994 (referred to as Open Firmware) compliant firmware.
44 The included Sparc32 and Sparc64 images are built from SVN revision 395. 44 The included Sparc32 and Sparc64 images are built from SVN revision 395.
45 - The included PowerPC image is built from SVN revision 418. 45 + The included PowerPC image is built from SVN revision 450.
46 46
47 - The PXE roms come from Rom-o-Matic etherboot 5.4.2. 47 - The PXE roms come from Rom-o-Matic etherboot 5.4.2.
48 pcnet32:pcnet32 -- [0x1022,0x2000] 48 pcnet32:pcnet32 -- [0x1022,0x2000]
pc-bios/openbios-ppc
No preview for this file type
qemu-doc.texi
@@ -2433,7 +2433,7 @@ QEMU emulates the following PowerMac peripherals: @@ -2433,7 +2433,7 @@ QEMU emulates the following PowerMac peripherals:
2433 2433
2434 @itemize @minus 2434 @itemize @minus
2435 @item 2435 @item
2436 -UniNorth PCI Bridge 2436 +UniNorth or Grackle PCI Bridge
2437 @item 2437 @item
2438 PCI VGA compatible card with VESA Bochs Extensions 2438 PCI VGA compatible card with VESA Bochs Extensions
2439 @item 2439 @item
@@ -2471,9 +2471,9 @@ QEMU uses the Open Hack&#39;Ware Open Firmware Compatible BIOS available at @@ -2471,9 +2471,9 @@ QEMU uses the Open Hack&#39;Ware Open Firmware Compatible BIOS available at
2471 @url{http://perso.magic.fr/l_indien/OpenHackWare/index.htm}. 2471 @url{http://perso.magic.fr/l_indien/OpenHackWare/index.htm}.
2472 2472
2473 Since version 0.9.1, QEMU uses OpenBIOS @url{http://www.openbios.org/} 2473 Since version 0.9.1, QEMU uses OpenBIOS @url{http://www.openbios.org/}
2474 -for the g3beige PowerMac machine. OpenBIOS is a free (GPL v2) portable  
2475 -firmware implementation. The goal is to implement a 100% IEEE  
2476 -1275-1994 (referred to as Open Firmware) compliant firmware. 2474 +for the g3beige and mac99 PowerMac machines. OpenBIOS is a free (GPL
  2475 +v2) portable firmware implementation. The goal is to implement a 100%
  2476 +IEEE 1275-1994 (referred to as Open Firmware) compliant firmware.
2477 2477
2478 @c man begin OPTIONS 2478 @c man begin OPTIONS
2479 2479