From patchwork Wed Oct 19 10:59:09 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Avi Kivity X-Patchwork-Id: 120592 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 A0D7CB71BF for ; Wed, 19 Oct 2011 22:00:16 +1100 (EST) Received: from localhost ([::1]:57211 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RGTsL-0008BC-35 for incoming@patchwork.ozlabs.org; Wed, 19 Oct 2011 06:59:57 -0400 Received: from eggs.gnu.org ([140.186.70.92]:48066) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RGTs7-00083W-Lc for qemu-devel@nongnu.org; Wed, 19 Oct 2011 06:59:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RGTs5-0005rN-Dx for qemu-devel@nongnu.org; Wed, 19 Oct 2011 06:59:43 -0400 Received: from mx1.redhat.com ([209.132.183.28]:63654) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RGTs5-0005qw-63 for qemu-devel@nongnu.org; Wed, 19 Oct 2011 06:59:41 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p9JAxd9F018381 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 19 Oct 2011 06:59:39 -0400 Received: from cleopatra.tlv.redhat.com (cleopatra.tlv.redhat.com [10.35.255.11]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p9JAxcTx005545; Wed, 19 Oct 2011 06:59:38 -0400 Received: from s01.tlv.redhat.com (s01.tlv.redhat.com [10.35.255.8]) by cleopatra.tlv.redhat.com (Postfix) with ESMTP id 1CAB4250B89; Wed, 19 Oct 2011 12:59:35 +0200 (IST) From: Avi Kivity To: Anthony Liguori , qemu-devel@nongnu.org Date: Wed, 19 Oct 2011 12:59:09 +0200 Message-Id: <1319021966-25613-2-git-send-email-avi@redhat.com> In-Reply-To: <1319021966-25613-1-git-send-email-avi@redhat.com> References: <1319021966-25613-1-git-send-email-avi@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 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) {