From patchwork Mon Oct 17 14:02:30 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Avi Kivity X-Patchwork-Id: 120207 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id E57D8B6F9B for ; Tue, 18 Oct 2011 01:03:30 +1100 (EST) Received: from localhost ([::1]:56688 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RFnmq-0002mL-Cx for incoming@patchwork.ozlabs.org; Mon, 17 Oct 2011 10:03:28 -0400 Received: from eggs.gnu.org ([140.186.70.92]:53704) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RFnmS-0002P2-Rm for qemu-devel@nongnu.org; Mon, 17 Oct 2011 10:03:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RFnmR-00035N-J5 for qemu-devel@nongnu.org; Mon, 17 Oct 2011 10:03:04 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36364) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RFnmR-00034C-3P for qemu-devel@nongnu.org; Mon, 17 Oct 2011 10:03:03 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p9HE32qF025680 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 17 Oct 2011 10:03:02 -0400 Received: from cleopatra.tlv.redhat.com (cleopatra.tlv.redhat.com [10.35.255.11]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p9HE31wp006003 for ; Mon, 17 Oct 2011 10:03:01 -0400 Received: from s01.tlv.redhat.com (s01.tlv.redhat.com [10.35.255.8]) by cleopatra.tlv.redhat.com (Postfix) with ESMTP id 4243B250B83; Mon, 17 Oct 2011 16:02:55 +0200 (IST) From: Avi Kivity To: qemu-devel@nongnu.org Date: Mon, 17 Oct 2011 16:02:30 +0200 Message-Id: <1318860167-14014-2-git-send-email-avi@redhat.com> In-Reply-To: <1318860167-14014-1-git-send-email-avi@redhat.com> References: <1318860167-14014-1-git-send-email-avi@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 01/18] ppc_oldworld: convert to memory API X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Avi Kivity --- hw/ppc_oldworld.c | 13 ++++++++----- 1 files changed, 8 insertions(+), 5 deletions(-) diff --git a/hw/ppc_oldworld.c b/hw/ppc_oldworld.c index ebcaafa..aac3526 100644 --- a/hw/ppc_oldworld.c +++ b/hw/ppc_oldworld.c @@ -73,11 +73,13 @@ static void ppc_heathrow_init (ram_addr_t ram_size, const char *initrd_filename, const char *cpu_model) { + MemoryRegion *sysmem = get_system_memory(); CPUState *env = NULL; char *filename; qemu_irq *pic, **heathrow_irqs; int linux_boot, i; - ram_addr_t ram_offset, bios_offset; + MemoryRegion *ram = g_new(MemoryRegion, 1); + MemoryRegion *bios = g_new(MemoryRegion, 1); uint32_t kernel_base, initrd_base, cmdline_base = 0; int32_t kernel_size, initrd_size; PCIBus *pci_bus; @@ -114,15 +116,16 @@ static void ppc_heathrow_init (ram_addr_t ram_size, exit(1); } - ram_offset = qemu_ram_alloc(NULL, "ppc_heathrow.ram", ram_size); - cpu_register_physical_memory(0, ram_size, ram_offset); + memory_region_init_ram(ram, NULL, "ppc_heathrow.ram", ram_size); + memory_region_add_subregion(sysmem, 0, ram); /* allocate and load BIOS */ - bios_offset = qemu_ram_alloc(NULL, "ppc_heathrow.bios", BIOS_SIZE); + memory_region_init_ram(bios, NULL, "ppc_heathrow.bios", BIOS_SIZE); if (bios_name == NULL) bios_name = PROM_FILENAME; filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); - cpu_register_physical_memory(PROM_ADDR, BIOS_SIZE, bios_offset | IO_MEM_ROM); + memory_region_set_readonly(bios, true); + memory_region_add_subregion(sysmem, PROM_ADDR, bios); /* Load OpenBIOS (ELF) */ if (filename) {