Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1J26JT-0007wj-MD for qemu-devel@nongnu.org; Tue, 11 Dec 2007 09:42:23 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1J26JR-0007sg-1H for qemu-devel@nongnu.org; Tue, 11 Dec 2007 09:42:22 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1J26JQ-0007sL-MC for qemu-devel@nongnu.org; Tue, 11 Dec 2007 09:42:20 -0500 Received: from province.act-europe.fr ([212.99.106.214]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1J26JQ-0003vE-Cg for qemu-devel@nongnu.org; Tue, 11 Dec 2007 09:42:20 -0500 Received: from localhost (localhost [127.0.0.1]) by filtered-province.act-europe.fr (Postfix) with ESMTP id 52F301648DB for ; Tue, 11 Dec 2007 15:42:09 +0100 (CET) Received: from province.act-europe.fr ([127.0.0.1]) by localhost (province.act-europe.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id iYRqp9ArbqiS for ; Tue, 11 Dec 2007 15:42:09 +0100 (CET) Received: from [10.10.127.242] (dhcp-guest-242.act-europe.fr [10.10.127.242]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by province.act-europe.fr (Postfix) with ESMTP id 0BC6A1648D2 for ; Tue, 11 Dec 2007 15:42:09 +0100 (CET) Mime-Version: 1.0 (Apple Message framework v752.3) Message-Id: Content-Type: multipart/mixed; boundary=Apple-Mail-5-33885528 From: Tristan Gingold Date: Tue, 11 Dec 2007 15:46:57 +0100 Subject: [Qemu-devel] patch: ppc_prep.c: use qemu_alloc_ram 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 --Apple-Mail-5-33885528 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Hi, this patch updates ppc_prep.c. It now uses qemu_ram_alloc. The original purpose of this patch was being able to use a bios bigger than 1MB. And updating ppc_prep.c was a better way than increasing BIOS_SIZE. Tristan. --Apple-Mail-5-33885528 Content-Transfer-Encoding: 7bit Content-Type: application/octet-stream; x-unix-mode=0644; name=qemu.diff Content-Disposition: attachment; filename=qemu.diff Index: hw/ppc_prep.c =================================================================== RCS file: /sources/qemu/qemu/hw/ppc_prep.c,v retrieving revision 1.59 diff -c -r1.59 ppc_prep.c *** hw/ppc_prep.c 2 Dec 2007 04:51:09 -0000 1.59 --- hw/ppc_prep.c 11 Dec 2007 14:14:27 -0000 *************** *** 546,554 **** char buf[1024]; nvram_t nvram; m48t59_t *m48t59; ! int PPC_io_memory; ! int linux_boot, i, nb_nics1, bios_size; ! unsigned long bios_offset; uint32_t kernel_base, kernel_size, initrd_base, initrd_size; PCIBus *pci_bus; qemu_irq *i8259; --- 546,554 ---- char buf[1024]; nvram_t nvram; m48t59_t *m48t59; ! int PPC_io_memory, ret; ! ram_addr_t ram_addr, vga_ram_addr, bios_offset; ! int linux_boot, i, nb_nics1, bios_size, bios_size_round; uint32_t kernel_base, kernel_size, initrd_base, initrd_size; PCIBus *pci_bus; qemu_irq *i8259; *************** *** 585,608 **** } /* allocate RAM */ ! cpu_register_physical_memory(0, ram_size, IO_MEM_RAM); /* allocate and load BIOS */ - bios_offset = ram_size + vga_ram_size; if (bios_name == NULL) bios_name = BIOS_FILENAME; snprintf(buf, sizeof(buf), "%s/%s", bios_dir, bios_name); ! bios_size = load_image(buf, phys_ram_base + bios_offset); ! if (bios_size < 0 || bios_size > BIOS_SIZE) { ! cpu_abort(env, "qemu: could not load PPC PREP bios '%s'\n", buf); ! exit(1); ! } if (env->nip < 0xFFF80000 && bios_size < 0x00100000) { cpu_abort(env, "PowerPC 601 / 620 / 970 need a 1MB BIOS\n"); } ! bios_size = (bios_size + 0xfff) & ~0xfff; ! cpu_register_physical_memory((uint32_t)(-bios_size), ! bios_size, bios_offset | IO_MEM_ROM); if (linux_boot) { kernel_base = KERNEL_LOAD_ADDR; --- 585,616 ---- } /* allocate RAM */ ! ram_addr = qemu_ram_alloc(ram_size); ! cpu_register_physical_memory(0, ram_size, ram_addr | IO_MEM_RAM); ! ! /* allocate VGA RAM */ ! vga_ram_addr = qemu_ram_alloc(vga_ram_size); /* allocate and load BIOS */ if (bios_name == NULL) bios_name = BIOS_FILENAME; snprintf(buf, sizeof(buf), "%s/%s", bios_dir, bios_name); ! bios_size = get_image_size(buf); ! if (bios_size < 0) ! goto bios_error; if (env->nip < 0xFFF80000 && bios_size < 0x00100000) { cpu_abort(env, "PowerPC 601 / 620 / 970 need a 1MB BIOS\n"); } ! bios_size_round = (bios_size + 0xfff) & ~0xfff; ! bios_offset = qemu_ram_alloc(bios_size_round); ! ret = load_image(buf, phys_ram_base + bios_offset); ! if (ret != bios_size) { ! bios_error: ! cpu_abort(env, "qemu: could not load PPC PREP bios '%s'\n", buf); ! exit(1); ! } ! cpu_register_physical_memory((uint32_t)(-bios_size_round), ! bios_size_round, bios_offset | IO_MEM_ROM); if (linux_boot) { kernel_base = KERNEL_LOAD_ADDR; *************** *** 661,667 **** cpu_register_physical_memory(0x80000000, 0x00800000, PPC_io_memory); /* init basic PC hardware */ ! pci_vga_init(pci_bus, ds, phys_ram_base + ram_size, ram_size, vga_ram_size, 0, 0); // openpic = openpic_init(0x00000000, 0xF0000000, 1); // pit = pit_init(0x40, i8259[0]); --- 669,675 ---- cpu_register_physical_memory(0x80000000, 0x00800000, PPC_io_memory); /* init basic PC hardware */ ! pci_vga_init(pci_bus, ds, phys_ram_base + vga_ram_addr, vga_ram_addr, vga_ram_size, 0, 0); // openpic = openpic_init(0x00000000, 0xF0000000, 1); // pit = pit_init(0x40, i8259[0]); --Apple-Mail-5-33885528--