From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LEBQz-00017v-TJ for qemu-devel@nongnu.org; Sat, 20 Dec 2008 18:40:37 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LEBQz-000172-35 for qemu-devel@nongnu.org; Sat, 20 Dec 2008 18:40:37 -0500 Received: from [199.232.76.173] (port=37123 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LEBQy-00016r-U7 for qemu-devel@nongnu.org; Sat, 20 Dec 2008 18:40:36 -0500 Received: from savannah.gnu.org ([199.232.41.3]:46263 helo=sv.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LEBQy-0000OG-CP for qemu-devel@nongnu.org; Sat, 20 Dec 2008 18:40:36 -0500 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.63) (envelope-from ) id 1LEBQx-0006Hf-Ss for qemu-devel@nongnu.org; Sat, 20 Dec 2008 23:40:35 +0000 Received: from aurel32 by cvs.savannah.gnu.org with local (Exim 4.63) (envelope-from ) id 1LEBQx-0006Hb-Kr for qemu-devel@nongnu.org; Sat, 20 Dec 2008 23:40:35 +0000 MIME-Version: 1.0 Errors-To: aurel32 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Aurelien Jarno Message-Id: Date: Sat, 20 Dec 2008 23:40:35 +0000 Subject: [Qemu-devel] [6114] target-ppc: modify hw/ppc_oldword.c to use qemu_ram_alloc() Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Revision: 6114 http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6114 Author: aurel32 Date: 2008-12-20 23:40:35 +0000 (Sat, 20 Dec 2008) Log Message: ----------- target-ppc: modify hw/ppc_oldword.c to use qemu_ram_alloc() This patch uses qemu_ram_alloc() to allocate RAM, VGA RAM and VGA BIOS. Signed-off-by: Blue Swirl Signed-off-by: Laurent Vivier Signed-off-by: Aurelien Jarno Modified Paths: -------------- trunk/hw/ppc_oldworld.c Modified: trunk/hw/ppc_oldworld.c =================================================================== --- trunk/hw/ppc_oldworld.c 2008-12-20 23:39:46 UTC (rev 6113) +++ trunk/hw/ppc_oldworld.c 2008-12-20 23:40:35 UTC (rev 6114) @@ -34,6 +34,7 @@ #include "boards.h" #define MAX_IDE_BUS 2 +#define VGA_BIOS_SIZE 65536 /* temporary frame buffer OSI calls for the video.x driver. The right solution is to modify the driver to use VGA PCI I/Os */ @@ -116,7 +117,7 @@ nvram_t nvram; m48t59_t *m48t59; int linux_boot, i; - unsigned long bios_offset, vga_bios_offset; + ram_addr_t ram_offset, vga_ram_offset, bios_offset, vga_bios_offset; uint32_t kernel_base, kernel_size, initrd_base, initrd_size; PCIBus *pci_bus; MacIONVRAMState *nvr; @@ -154,10 +155,14 @@ } /* allocate RAM */ - cpu_register_physical_memory(0, ram_size, IO_MEM_RAM); + ram_offset = qemu_ram_alloc(ram_size); + cpu_register_physical_memory(0, ram_size, ram_offset); + /* allocate VGA RAM */ + vga_ram_offset = qemu_ram_alloc(vga_ram_size); + /* allocate and load BIOS */ - bios_offset = ram_size + vga_ram_size; + bios_offset = qemu_ram_alloc(BIOS_SIZE); if (bios_name == NULL) bios_name = BIOS_FILENAME; snprintf(buf, sizeof(buf), "%s/%s", bios_dir, bios_name); @@ -166,7 +171,6 @@ cpu_abort(env, "qemu: could not load PowerPC bios '%s'\n", buf); exit(1); } - bios_size = (bios_size + 0xfff) & ~0xfff; if (bios_size > 0x00080000) { /* As the NVRAM is located at 0xFFF04000, we cannot use 1 MB BIOSes */ cpu_abort(env, "G3BW Mac hardware can not handle 1 MB BIOS\n"); @@ -175,7 +179,7 @@ bios_size, bios_offset | IO_MEM_ROM); /* allocate and load VGA BIOS */ - vga_bios_offset = bios_offset + bios_size; + vga_bios_offset = qemu_ram_alloc(VGA_BIOS_SIZE); snprintf(buf, sizeof(buf), "%s/%s", bios_dir, VGABIOS_FILENAME); vga_bios_size = load_image(buf, phys_ram_base + vga_bios_offset + 8); if (vga_bios_size < 0) { @@ -193,7 +197,6 @@ vga_bios_size); vga_bios_size += 8; } - vga_bios_size = (vga_bios_size + 0xfff) & ~0xfff; if (linux_boot) { kernel_base = KERNEL_LOAD_ADDR; @@ -278,8 +281,8 @@ } pic = heathrow_pic_init(&pic_mem_index, 1, heathrow_irqs); pci_bus = pci_grackle_init(0xfec00000, pic); - pci_vga_init(pci_bus, ds, phys_ram_base + ram_size, - ram_size, vga_ram_size, + pci_vga_init(pci_bus, ds, phys_ram_base + vga_ram_offset, + vga_ram_offset, vga_ram_size, vga_bios_offset, vga_bios_size); /* XXX: suppress that */ @@ -369,6 +372,6 @@ .name = "g3bw", .desc = "Heathrow based PowerMAC", .init = ppc_heathrow_init, - .ram_require = BIOS_SIZE + VGA_RAM_SIZE, + .ram_require = BIOS_SIZE + VGA_BIOS_SIZE + VGA_RAM_SIZE, .max_cpus = MAX_CPUS, };