From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47817) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VWml3-0002wi-QF for qemu-devel@nongnu.org; Thu, 17 Oct 2013 08:33:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VWmkx-00075L-Lx for qemu-devel@nongnu.org; Thu, 17 Oct 2013 08:32:53 -0400 Received: from p15195424.pureserver.info ([82.165.34.74]:55100) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VWmkx-00074r-Fw for qemu-devel@nongnu.org; Thu, 17 Oct 2013 08:32:47 -0400 Message-ID: <525FD8AA.2030306@ilande.co.uk> Date: Thu, 17 Oct 2013 13:31:38 +0100 From: Mark Cave-Ayland MIME-Version: 1.0 References: <1381868394-12656-1-git-send-email-mark.cave-ayland@ilande.co.uk> <1381868394-12656-2-git-send-email-mark.cave-ayland@ilande.co.uk> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 1/2] sun4m: Add Sun CG3 framebuffer and corresponding OpenBIOS FCode ROM List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: Blue Swirl , Bob Breuer , QEMU Developers , Artyom Tarasenko On 15/10/13 22:46, Peter Maydell wrote: > On 15 October 2013 21:19, Mark Cave-Ayland > wrote: >> + /* FCode ROM */ >> + memory_region_init_ram(&s->rom, NULL, "cg3.prom", FCODE_MAX_ROM_SIZE); >> + vmstate_register_ram_global(&s->rom); >> + memory_region_set_readonly(&s->rom, true); >> + sysbus_init_mmio(dev,&s->rom); >> + >> + fcode_filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, CG3_ROM_FILE); >> + if (fcode_filename) { >> + ret = load_image_targphys(fcode_filename, s->prom_addr, >> + FCODE_MAX_ROM_SIZE); >> + } > > Ideally we would have a 'load image into RAM memory region' function, > and then we wouldn't need to pass the device the address of its own > memory region. Oh well... Yes, definitely the ROM image code is lacking from post-MemoryRegion love. For example load_image_targphys() indirectly creates a MemoryRegion to hold the loaded ROM contents, but it only becomes visible (presumably because of SysBus) when another RAM MemoryRegion is installed at the same address. Hence you actually end up having to claim twice the memory requirement of your original ROM. ATB, Mark.