From: "Hervé Poussineau" <hpoussin@reactos.org>
To: "Andreas Färber" <andreas.faerber@web.de>
Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v3 03/10] raven: move BIOS loading from board code to PCI host
Date: Mon, 23 Dec 2013 07:48:19 +0100 [thread overview]
Message-ID: <52B7DCB3.40202@reactos.org> (raw)
In-Reply-To: <52B78C3D.4030703@web.de>
Hi,
Andreas Färber a écrit :
> Hi,
>
> Am 05.11.2013 00:09, schrieb Hervé Poussineau:
>> Raven datasheet explains where firmware lives in system memory, so do
>> it there instead of in board code. Other boards using the same PCI
>> host will not have to copy the firmware loading code.
>
> This part we had discussed and no one objected to the approach, so OK.
>
>> However, add a specific hack for Open Hack'Ware, which provides only
>> a 512KB blob to be loaded at 0xfff00000, but expects valid code at
>> 0xfffffffc (specific Open Hack'Ware reset instruction pointer).
>
> Was this part explained before? I don't spot the equivalent in the
> deleted code. If this is a new workaround, I would rather like to put it
> in a separate patch for bisecting (can offer to do that myself then).
> What are the symptoms? I am testing all these patches with OHW.
Old code does (error checking removed):
>> - bios_size = get_image_size(filename);
>> - bios_addr = (uint32_t)(-bios_size);
>> - bios_size = load_image_targphys(filename, bios_addr,
Ie, bios_addr = -512KB (size of OHW blob) = 0xfff80000
and firmware is loaded in the range 0xfff80000-0xffffffff
OHW expects reset instruction pointer to be 0xfffffffc (not valid for
604, but that's not the point now), which contains a valid instruction.
Note that range 0xfff00000-0xfff7ffff is empty.
Datasheet for raven says that firmware is at 0xfff00000, so I changed
code to:
+#define BIOS_SIZE (1024 * 1024)
+ bios_addr = (uint32_t)(-BIOS_SIZE);
+ bios_size = load_image_targphys(filename, bios_addr,
+ bios_size);
Ie, bios_addr = -1MB = 0xfff00000
and firmware is loaded in the range 0xfff00000-0xfff7ffff.
This doesn't work due to reset instruction pointer which now is pointing
to empty memory, and symptoms are an empty screen on OHW.
So, I'm adding this hack for OHW, to mirror the 0xfff00000-0xfff7ffff
range to 0xfff80000-0xffffffff.
So, this patch is a small functional change, as it adds a copy of the
firmware in a new range 0xfff00000-0xfff7ffff, but I think we can live
with it.
We'll be able to remove it once we switch to another firmware which uses
the right reset instruction pointer.
Regards,
Hervé
>> Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
>> ---
>> hw/pci-host/prep.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++
>> hw/ppc/prep.c | 50 +++++++++++++-------------------------------------
>> 2 files changed, 64 insertions(+), 37 deletions(-)
> [...]
>> diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c
>> index 9f8538c..8a09e2b 100644
>> --- a/hw/ppc/prep.c
>> +++ b/hw/ppc/prep.c
> [...]
>> @@ -510,41 +509,13 @@ static void ppc_prep_init(QEMUMachineInitArgs *args)
>> memory_region_add_subregion(sysmem, 0, ram);
>>
>> /* allocate and load BIOS */
>> - memory_region_init_ram(bios, NULL, "ppc_prep.bios", BIOS_SIZE);
>> - memory_region_set_readonly(bios, true);
>> - memory_region_add_subregion(sysmem, (uint32_t)(-BIOS_SIZE), bios);
>> - vmstate_register_ram_global(bios);
>> - if (bios_name == NULL)
>> - bios_name = BIOS_FILENAME;
>> - filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
>> - if (filename) {
>> - bios_size = load_elf(filename, NULL, NULL, NULL,
>> - NULL, NULL, 1, ELF_MACHINE, 0);
>> - if (bios_size < 0) {
>> - bios_size = get_image_size(filename);
>> - if (bios_size > 0 && bios_size <= BIOS_SIZE) {
>> - hwaddr bios_addr;
>> - bios_size = (bios_size + 0xfff) & ~0xfff;
>> - bios_addr = (uint32_t)(-bios_size);
>> - bios_size = load_image_targphys(filename, bios_addr, bios_size);
>> - }
>> - if (bios_size > BIOS_SIZE) {
>> - fprintf(stderr, "qemu: PReP bios '%s' is too large (0x%x)\n",
>> - bios_name, bios_size);
>> - exit(1);
>> - }
>> - }
>> - } else {
>> - bios_size = -1;
>> - }
>> - if (bios_size < 0 && !qtest_enabled()) {
>> - fprintf(stderr, "qemu: could not load PPC PReP bios '%s'\n",
>> - bios_name);
>> - exit(1);
>> - }
>> - if (filename) {
>> - g_free(filename);
>> - }
>> + /* Open Hack'Ware hack: bios size is 512K and is loaded at 0xfff00000.
>> + * However, reset address is 0xfffffffc. Mirror the bios from
>> + * 0xfff00000 to 0xfff80000.
>> + */
>> + memory_region_init_alias(bios, NULL, "bios-alias", sysmem, 0xfff00000,
>> + 0x00080000);
>> + memory_region_add_subregion_overlap(sysmem, 0xfff80000, bios, 1);
>>
>> if (linux_boot) {
>> kernel_base = KERNEL_LOAD_ADDR;
> [snip]
>
>
next prev parent reply other threads:[~2013-12-23 6:48 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-04 23:09 [Qemu-devel] [PATCH v3 00/10] prep: improve Raven PCI host emulation Hervé Poussineau
2013-11-04 23:09 ` [Qemu-devel] [PATCH v3 01/10] prep: kill get_system_io() usage Hervé Poussineau
2013-11-04 23:09 ` [Qemu-devel] [PATCH v3 02/10] raven: use constant PCI_NUM_PINS instead of 4 Hervé Poussineau
2013-11-04 23:09 ` [Qemu-devel] [PATCH v3 03/10] raven: move BIOS loading from board code to PCI host Hervé Poussineau
2013-12-23 1:05 ` Andreas Färber
2013-12-23 6:48 ` Hervé Poussineau [this message]
2013-12-23 6:48 ` Hervé Poussineau
2013-12-23 10:24 ` [Qemu-devel] [Qemu-ppc] " Alexander Graf
2013-12-23 18:13 ` Hervé Poussineau
2013-12-23 20:02 ` Andreas Färber
2013-12-23 21:54 ` Hervé Poussineau
2013-12-24 0:32 ` Alexander Graf
2013-12-24 2:02 ` Andreas Färber
2013-12-24 6:32 ` Hervé Poussineau
2013-12-29 16:28 ` Alexander Graf
2013-12-24 14:06 ` Mark Cave-Ayland
2013-12-23 18:36 ` [Qemu-devel] " Peter Maydell
2013-12-23 19:16 ` Hervé Poussineau
2013-11-04 23:09 ` [Qemu-devel] [PATCH v3 04/10] raven: rename intack region to pci_intack Hervé Poussineau
2013-11-04 23:09 ` [Qemu-devel] [PATCH v3 05/10] raven: set a correct PCI I/O memory region Hervé Poussineau
2014-03-13 17:09 ` Andreas Färber
2014-03-13 20:56 ` Hervé Poussineau
2013-11-04 23:09 ` [Qemu-devel] [PATCH v3 06/10] raven: set a correct PCI " Hervé Poussineau
2013-11-04 23:09 ` [Qemu-devel] [PATCH v3 07/10] raven: add PCI bus mastering address space Hervé Poussineau
2013-11-04 23:09 ` [Qemu-devel] [PATCH v3 08/10] raven: implement non-contiguous I/O region Hervé Poussineau
2014-03-13 17:19 ` Andreas Färber
2013-11-04 23:09 ` [Qemu-devel] [PATCH v3 09/10] raven: fix PCI bus accesses with size > 1 Hervé Poussineau
2013-11-04 23:09 ` [Qemu-devel] [PATCH v3 10/10] raven: use raven_ for all function prefixes Hervé Poussineau
2013-12-23 0:52 ` [Qemu-devel] [PATCH v3 00/10] prep: improve Raven PCI host emulation Andreas Färber
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=52B7DCB3.40202@reactos.org \
--to=hpoussin@reactos.org \
--cc=andreas.faerber@web.de \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).