* [Qemu-devel] Re: [PATCH 0/2][RFC][PPC] openbios support
[not found] <1229635267-16897-1-git-send-email-Laurent@lvivier.info>
@ 2008-12-19 8:45 ` Aurelien Jarno
2008-12-20 7:54 ` François Revol
[not found] ` <1229635267-16897-2-git-send-email-Laurent@lvivier.info>
1 sibling, 1 reply; 12+ messages in thread
From: Aurelien Jarno @ 2008-12-19 8:45 UTC (permalink / raw)
To: Laurent Vivier; +Cc: Blue Swirl, qemu-devel
Laurent Vivier a écrit :
> These two patches allows to load an openbios elf image instead of an
> openhackware image.
>
> [PATCH 1/2][RFC] Modify hw/ppc_oldword.c to use qemu_ram_alloc().
> [PATCH 2/2][RFC] Load an OpenBios ELF image instead of OpenHackware binary
Great job! We are closer to get rid of OpenHackware.
However I have tried those patches with the latest SVN from OpenBios,
and I am unable to get the machine booting. Do we need other patches for
OpenBios or QEMU? It would be nice to make them available, even if they
are not ready for merge.
--
.''`. Aurelien Jarno | GPG: 1024D/F1BCDB73
: :' : Debian developer | Electrical Engineer
`. `' aurel32@debian.org | aurelien@aurel32.net
`- people.debian.org/~aurel32 | www.aurel32.net
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Qemu-devel] Re: [PATCH 2/2][RFC] Load an OpenBios ELF image instead of OpenHackware binary object if found
[not found] ` <1229635267-16897-3-git-send-email-Laurent@lvivier.info>
@ 2008-12-19 8:45 ` Aurelien Jarno
2008-12-19 12:12 ` Paul Brook
0 siblings, 1 reply; 12+ messages in thread
From: Aurelien Jarno @ 2008-12-19 8:45 UTC (permalink / raw)
To: Laurent Vivier; +Cc: Blue Swirl, qemu-devel
Laurent Vivier a écrit :
> This patch try to load an OpenBIOS ELF image instead of
> OpenHackware binary. Default behavior is used if the OpenBIOS (openbios-ppc32)
> file is not found
Actually, I wonder if it won't be simpler to just remove OpenHackware
and always use the OpenBIOS image.
> Signed-off-by: Laurent Vivier <Laurent@lvivier.info>
> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
> ---
> hw/ppc_mac.h | 2 ++
> hw/ppc_oldworld.c | 32 ++++++++++++++++++++++----------
> 2 files changed, 24 insertions(+), 10 deletions(-)
>
> diff --git a/hw/ppc_mac.h b/hw/ppc_mac.h
> index 3a26cde..c833d17 100644
> --- a/hw/ppc_mac.h
> +++ b/hw/ppc_mac.h
> @@ -31,6 +31,8 @@
> #define BIOS_FILENAME "ppc_rom.bin"
> #define VGABIOS_FILENAME "video.x"
> #define NVRAM_SIZE 0x2000
> +#define PROM_FILENAME "openbios-ppc32"
> +#define PROM_ADDR 0xfff00000
>
> #define KERNEL_LOAD_ADDR 0x01000000
> #define INITRD_LOAD_ADDR 0x01800000
> diff --git a/hw/ppc_oldworld.c b/hw/ppc_oldworld.c
> index 696add2..73cf4ab 100644
> --- a/hw/ppc_oldworld.c
> +++ b/hw/ppc_oldworld.c
> @@ -164,19 +164,31 @@ static void ppc_heathrow_init (ram_addr_t ram_size, int vga_ram_size,
> /* allocate and load BIOS */
> bios_offset = qemu_ram_alloc(BIOS_SIZE);
> if (bios_name == NULL)
> - bios_name = BIOS_FILENAME;
> + bios_name = PROM_FILENAME;
> snprintf(buf, sizeof(buf), "%s/%s", bios_dir, bios_name);
> - bios_size = load_image(buf, phys_ram_base + bios_offset);
> + cpu_register_physical_memory(PROM_ADDR, BIOS_SIZE, bios_offset | IO_MEM_ROM);
> + /* First try OpenBIOS (ELF) */
> + bios_size = load_elf(buf, 0, NULL, NULL, NULL);
> if (bios_size < 0 || bios_size > BIOS_SIZE) {
> - cpu_abort(env, "qemu: could not load PowerPC bios '%s'\n", buf);
> - exit(1);
> - }
> - if (bios_size > 0x00080000) {
> - /* As the NVRAM is located at 0xFFF04000, we cannot use 1 MB BIOSes */
> - cpu_abort(env, "G3BW Mac hardware can not handle 1 MB BIOS\n");
> +
> + /* OpenHackWare */
> +
> + bios_name = BIOS_FILENAME;
> + snprintf(buf, sizeof(buf), "%s/%s", bios_dir, bios_name);
> + bios_size = get_image_size(buf);
> + bios_size = load_image_targphys(buf, (uint32_t)(-bios_size), bios_size);
> + if (bios_size < 0 || bios_size > BIOS_SIZE) {
> + cpu_abort(env, "qemu: could not load PowerPC bios '%s'\n", buf);
> + exit(1);
> + }
> + bios_size = (bios_size + 0xfff) & ~0xffff;
> + if (bios_size > 0x00080000) {
> + /* As the NVRAM is located at 0xFFF04000,
> + * we cannot use 1 MB BIOSes
> + */
> + cpu_abort(env, "G3BW Mac hardware can not handle 1 MB BIOS\n");
> + }
> }
> - cpu_register_physical_memory((uint32_t)(-bios_size),
> - bios_size, bios_offset | IO_MEM_ROM);
>
> /* allocate and load VGA BIOS */
> vga_bios_offset = qemu_ram_alloc(VGA_BIOS_SIZE);
--
.''`. Aurelien Jarno | GPG: 1024D/F1BCDB73
: :' : Debian developer | Electrical Engineer
`. `' aurel32@debian.org | aurelien@aurel32.net
`- people.debian.org/~aurel32 | www.aurel32.net
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Qemu-devel] Re: [PATCH 1/2][RFC] Modify hw/ppc_oldword.c to use qemu_ram_alloc().
[not found] ` <1229635267-16897-2-git-send-email-Laurent@lvivier.info>
[not found] ` <1229635267-16897-3-git-send-email-Laurent@lvivier.info>
@ 2008-12-19 8:45 ` Aurelien Jarno
2008-12-20 23:41 ` Aurelien Jarno
2 siblings, 0 replies; 12+ messages in thread
From: Aurelien Jarno @ 2008-12-19 8:45 UTC (permalink / raw)
To: Laurent Vivier; +Cc: Blue Swirl, qemu-devel
Laurent Vivier a écrit :
> This patch uses qemu_ram_alloc() to allocate RAM, VGA RAM and VGA BIOS.
This patch looks good, I think it could be merged. Any objection to that?
> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
> Signed-off-by: Laurent Vivier <Laurent@lvivier.info>
> ---
> hw/ppc_oldworld.c | 21 ++++++++++++---------
> 1 files changed, 12 insertions(+), 9 deletions(-)
>
> diff --git a/hw/ppc_oldworld.c b/hw/ppc_oldworld.c
> index 0265596..696add2 100644
> --- a/hw/ppc_oldworld.c
> +++ b/hw/ppc_oldworld.c
> @@ -34,6 +34,7 @@
> #include "boards.h"
>
> #define MAX_IDE_BUS 2
> +#define VGA_BIOS_SIZE 65536
>
> /* temporary frame buffer OSI calls for the video.x driver. The right
> solution is to modify the driver to use VGA PCI I/Os */
> @@ -116,7 +117,7 @@ static void ppc_heathrow_init (ram_addr_t ram_size, int vga_ram_size,
> nvram_t nvram;
> m48t59_t *m48t59;
> int linux_boot, i;
> - unsigned long bios_offset, vga_bios_offset;
> + ram_addr_t ram_offset, vga_ram_offset, bios_offset, vga_bios_offset;
> uint32_t kernel_base, kernel_size, initrd_base, initrd_size;
> PCIBus *pci_bus;
> MacIONVRAMState *nvr;
> @@ -154,10 +155,14 @@ static void ppc_heathrow_init (ram_addr_t ram_size, int vga_ram_size,
> }
>
> /* allocate RAM */
> - cpu_register_physical_memory(0, ram_size, IO_MEM_RAM);
> + ram_offset = qemu_ram_alloc(ram_size);
> + cpu_register_physical_memory(0, ram_size, ram_offset);
> +
> + /* allocate VGA RAM */
> + vga_ram_offset = qemu_ram_alloc(vga_ram_size);
>
> /* allocate and load BIOS */
> - bios_offset = ram_size + vga_ram_size;
> + bios_offset = qemu_ram_alloc(BIOS_SIZE);
> if (bios_name == NULL)
> bios_name = BIOS_FILENAME;
> snprintf(buf, sizeof(buf), "%s/%s", bios_dir, bios_name);
> @@ -166,7 +171,6 @@ static void ppc_heathrow_init (ram_addr_t ram_size, int vga_ram_size,
> cpu_abort(env, "qemu: could not load PowerPC bios '%s'\n", buf);
> exit(1);
> }
> - bios_size = (bios_size + 0xfff) & ~0xfff;
> if (bios_size > 0x00080000) {
> /* As the NVRAM is located at 0xFFF04000, we cannot use 1 MB BIOSes */
> cpu_abort(env, "G3BW Mac hardware can not handle 1 MB BIOS\n");
> @@ -175,7 +179,7 @@ static void ppc_heathrow_init (ram_addr_t ram_size, int vga_ram_size,
> bios_size, bios_offset | IO_MEM_ROM);
>
> /* allocate and load VGA BIOS */
> - vga_bios_offset = bios_offset + bios_size;
> + vga_bios_offset = qemu_ram_alloc(VGA_BIOS_SIZE);
> snprintf(buf, sizeof(buf), "%s/%s", bios_dir, VGABIOS_FILENAME);
> vga_bios_size = load_image(buf, phys_ram_base + vga_bios_offset + 8);
> if (vga_bios_size < 0) {
> @@ -193,7 +197,6 @@ static void ppc_heathrow_init (ram_addr_t ram_size, int vga_ram_size,
> vga_bios_size);
> vga_bios_size += 8;
> }
> - vga_bios_size = (vga_bios_size + 0xfff) & ~0xfff;
>
> if (linux_boot) {
> kernel_base = KERNEL_LOAD_ADDR;
> @@ -278,8 +281,8 @@ static void ppc_heathrow_init (ram_addr_t ram_size, int vga_ram_size,
> }
> pic = heathrow_pic_init(&pic_mem_index, 1, heathrow_irqs);
> pci_bus = pci_grackle_init(0xfec00000, pic);
> - pci_vga_init(pci_bus, ds, phys_ram_base + ram_size,
> - ram_size, vga_ram_size,
> + pci_vga_init(pci_bus, ds, phys_ram_base + vga_ram_offset,
> + vga_ram_offset, vga_ram_size,
> vga_bios_offset, vga_bios_size);
>
> /* XXX: suppress that */
> @@ -369,6 +372,6 @@ QEMUMachine heathrow_machine = {
> .name = "g3bw",
> .desc = "Heathrow based PowerMAC",
> .init = ppc_heathrow_init,
> - .ram_require = BIOS_SIZE + VGA_RAM_SIZE,
> + .ram_require = BIOS_SIZE + VGA_BIOS_SIZE + VGA_RAM_SIZE,
> .max_cpus = MAX_CPUS,
> };
--
.''`. Aurelien Jarno | GPG: 1024D/F1BCDB73
: :' : Debian developer | Electrical Engineer
`. `' aurel32@debian.org | aurelien@aurel32.net
`- people.debian.org/~aurel32 | www.aurel32.net
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Qemu-devel] Re: [PATCH 0/2][RFC][PPC] openbios support
@ 2008-12-19 8:54 laurent
2008-12-19 10:23 ` Aurelien Jarno
0 siblings, 1 reply; 12+ messages in thread
From: laurent @ 2008-12-19 8:54 UTC (permalink / raw)
To: aurelien; +Cc: blauwirbel, qemu-devel
>Laurent Vivier a écrit :
>> These two patches allows to load an openbios elf image instead of an
>> openhackware image.
>>
>> [PATCH 1/2][RFC] Modify hw/ppc_oldword.c to use qemu_ram_alloc().
>> [PATCH 2/2][RFC] Load an OpenBios ELF image instead of OpenHackware binary
>
>Great job! We are closer to get rid of OpenHackware.
>
>However I have tried those patches with the latest SVN from OpenBios,
>and I am unable to get the machine booting. Do we need other patches for
>OpenBios or QEMU? It would be nice to make them available, even if they
>are not ready for merge.
Yes, we need more patches:
- for qemu, an nvram cleanup I already sent some month ago, and a little PCI cleanup patch.
- for openbios, at leat one patch to remap ROM in RAM.
I'm working hard to make them available, but currently, openbios is able to load Yaboot and Yaboot is able to load linux, but linux crashes when it is building its flattened device tree.
Regards,
Laurent
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Qemu-devel] Re: [PATCH 0/2][RFC][PPC] openbios support
2008-12-19 8:54 [Qemu-devel] Re: [PATCH 0/2][RFC][PPC] openbios support laurent
@ 2008-12-19 10:23 ` Aurelien Jarno
0 siblings, 0 replies; 12+ messages in thread
From: Aurelien Jarno @ 2008-12-19 10:23 UTC (permalink / raw)
To: laurent; +Cc: blauwirbel, qemu-devel
On Fri, Dec 19, 2008 at 09:54:54AM +0100, laurent@lvivier.info wrote:
> >Laurent Vivier a écrit :
> >> These two patches allows to load an openbios elf image instead of an
> >> openhackware image.
> >>
> >> [PATCH 1/2][RFC] Modify hw/ppc_oldword.c to use qemu_ram_alloc().
> >> [PATCH 2/2][RFC] Load an OpenBios ELF image instead of OpenHackware binary
> >
> >Great job! We are closer to get rid of OpenHackware.
> >
> >However I have tried those patches with the latest SVN from OpenBios,
> >and I am unable to get the machine booting. Do we need other patches for
> >OpenBios or QEMU? It would be nice to make them available, even if they
> >are not ready for merge.
>
> Yes, we need more patches:
>
> - for qemu, an nvram cleanup I already sent some month ago, and a little PCI cleanup patch.
Could you please resent it? I will apply it if everything is ok.
--
.''`. Aurelien Jarno | GPG: 1024D/F1BCDB73
: :' : Debian developer | Electrical Engineer
`. `' aurel32@debian.org | aurelien@aurel32.net
`- people.debian.org/~aurel32 | www.aurel32.net
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Qemu-devel] Re: [PATCH 0/2][RFC][PPC] openbios support
@ 2008-12-19 10:55 laurent
2008-12-19 17:50 ` Blue Swirl
0 siblings, 1 reply; 12+ messages in thread
From: laurent @ 2008-12-19 10:55 UTC (permalink / raw)
To: aurelien; +Cc: blauwirbel, qemu-devel
[-- Attachment #1: Type: text/plain, Size: 992 bytes --]
>On Fri, Dec 19, 2008 at 09:54:54AM +0100, laurent@lvivier.info wrote:
>> >Laurent Vivier a écrit :
>> >> These two patches allows to load an openbios elf image instead of an
>> >> openhackware image.
>> >>
>> >> [PATCH 1/2][RFC] Modify hw/ppc_oldword.c to use qemu_ram_alloc().
>> >> [PATCH 2/2][RFC] Load an OpenBios ELF image instead of OpenHackware
>binary
>> >
>> >Great job! We are closer to get rid of OpenHackware.
>> >
>> >However I have tried those patches with the latest SVN from OpenBios,
>> >and I am unable to get the machine booting. Do we need other patches for
>> >OpenBios or QEMU? It would be nice to make them available, even if they
>> >are not ready for merge.
>>
>> Yes, we need more patches:
>>
>> - for qemu, an nvram cleanup I already sent some month ago, and a little PCI
>cleanup patch.
>
>Could you please resent it? I will apply it if everything is ok.
Here it is.
Note that the NVRAM is stored into a file.
Regards,
Laurent
[-- Attachment #2: 0001-PowerMac-NVRAM-cleanup.patch --]
[-- Type: application/octet-stream, Size: 7403 bytes --]
>From 7d45ab963a98c4b26bd087dedd6714d9f3c2fd5e Mon Sep 17 00:00:00 2001
From: Laurent Vivier <Laurent@lvivier.info>
Date: Thu, 18 Dec 2008 22:08:00 +0100
Subject: [PATCH] PowerMac NVRAM cleanup
Signed-off-by: Laurent Vivier <Laurent@lvivier.info>
---
hw/mac_nvram.c | 122 ++++++++++++++++++++++++++++++++++++++++++-----------
hw/ppc_mac.h | 4 +-
hw/ppc_oldworld.c | 4 +-
3 files changed, 101 insertions(+), 29 deletions(-)
diff --git a/hw/mac_nvram.c b/hw/mac_nvram.c
index f608ace..95b249e 100644
--- a/hw/mac_nvram.c
+++ b/hw/mac_nvram.c
@@ -23,12 +23,17 @@
* THE SOFTWARE.
*/
#include "hw.h"
+#include "firmware_abi.h"
#include "ppc_mac.h"
+#define DEF_SYSTEM_SIZE 0xc10
+
struct MacIONVRAMState {
+ target_phys_addr_t mem_base;
target_phys_addr_t size;
+ QEMUFile *file;
int mem_index;
- uint8_t data[0x2000];
+ uint8_t data[NVRAM_SIZE];
};
/* Direct access to NVRAM */
@@ -38,7 +43,7 @@ uint32_t macio_nvram_read (void *opaque, uint32_t addr)
uint32_t ret;
// printf("%s: %p addr %04x\n", __func__, s, addr);
- if (addr < 0x2000)
+ if (addr < NVRAM_SIZE)
ret = s->data[addr];
else
ret = -1;
@@ -51,7 +56,7 @@ void macio_nvram_write (void *opaque, uint32_t addr, uint32_t val)
MacIONVRAMState *s = opaque;
// printf("%s: %p addr %04x val %02x\n", __func__, s, addr, val);
- if (addr < 0x2000)
+ if (addr < NVRAM_SIZE)
s->data[addr] = val;
}
@@ -61,9 +66,14 @@ static void macio_nvram_writeb (void *opaque,
{
MacIONVRAMState *s = opaque;
- addr = (addr >> 4) & 0x1fff;
+ addr = (addr >> 4) & (NVRAM_SIZE-1);
s->data[addr] = value;
// printf("macio_nvram_writeb %04x = %02x\n", addr, value);
+ if (s->file) {
+ qemu_fseek(s->file, addr, SEEK_SET);
+ qemu_put_byte(s->file, value);
+ qemu_fflush(s->file);
+ }
}
static uint32_t macio_nvram_readb (void *opaque, target_phys_addr_t addr)
@@ -71,7 +81,7 @@ static uint32_t macio_nvram_readb (void *opaque, target_phys_addr_t addr)
MacIONVRAMState *s = opaque;
uint32_t value;
- addr = (addr >> 4) & 0x1fff;
+ addr = (addr >> 4) & (NVRAM_SIZE-1);
value = s->data[addr];
// printf("macio_nvram_readb %04x = %02x\n", addr, value);
@@ -90,17 +100,32 @@ static CPUReadMemoryFunc *nvram_read[] = {
&macio_nvram_readb,
};
-MacIONVRAMState *macio_nvram_init (int *mem_index, target_phys_addr_t size)
+MacIONVRAMState *macio_nvram_init (int *mem_index, const char *filename)
{
MacIONVRAMState *s;
+ QEMUFile *file;
s = qemu_mallocz(sizeof(MacIONVRAMState));
if (!s)
return NULL;
- s->size = size;
+ s->size = NVRAM_SIZE << 4;
s->mem_index = cpu_register_io_memory(0, nvram_read, nvram_write, s);
*mem_index = s->mem_index;
+ /* Read current file */
+ file = qemu_fopen(filename, "rb");
+ if (file) {
+ /* Read nvram contents */
+ qemu_get_buffer(file, s->data, s->size >> 4);
+ qemu_fclose(file);
+ }
+ s->file = qemu_fopen(filename, "wb");
+ if (s->file) {
+ /* Write back contents, as 'wb' mode cleaned the file */
+ qemu_put_buffer(s->file, s->data, s->size >> 4);
+ qemu_fflush(s->file);
+ }
+
return s;
}
@@ -112,26 +137,73 @@ void macio_nvram_map (void *opaque, target_phys_addr_t mem_base)
cpu_register_physical_memory(mem_base, s->size, s->mem_index);
}
-static uint8_t nvram_chksum (const uint8_t *buf, int n)
+static void nvram_set_header(MacIONVRAMState *nvr,
+ uint32_t addr,
+ uint8_t signature,
+ uint16_t size,
+ const char* name)
+{
+ struct OpenBIOS_nvpart_v1 *nvpart = (struct OpenBIOS_nvpart_v1 *)(nvr->data + addr);
+
+ memset(nvpart, 0, sizeof(*nvpart));
+ nvpart->signature = signature;
+ strncpy(nvpart->name, name, sizeof(nvpart->name));
+ OpenBIOS_finish_partition(nvpart, size);
+}
+
+static void create_free_part(MacIONVRAMState *nvr, uint32_t addr, int size )
+{
+ nvram_set_header(nvr, addr, OPENBIOS_PART_FREE, size, "777777777777");
+}
+
+static int
+next_nvpart(MacIONVRAMState *nvr, uint32_t *addr, uint32_t end)
+{
+ struct OpenBIOS_nvpart_v1 *nvpart = (struct OpenBIOS_nvpart_v1 *)(nvr->data + *addr);
+ int len;
+
+ len = be16_to_cpu(nvpart->len);
+ if (len == 0)
+ return 1;
+
+ *addr = (*addr) + len;
+ if( *addr < end )
+ return 1;
+ if( *addr == end )
+ return 0;
+ return -1;
+}
+
+static int create_nv_part(MacIONVRAMState *nvr, uint32_t base, int max_size,
+ int signature, const char *name, int size )
{
- int sum, i;
- sum = 0;
- for(i = 0; i < n; i++)
- sum += buf[i];
- return (sum & 0xff) + (sum >> 8);
+ struct OpenBIOS_nvpart_v1 *nvpart;
+ uint32_t addr = base;
+ uint32_t end = base + max_size;
+ int len;
+
+ do {
+ nvpart = (struct OpenBIOS_nvpart_v1 *)(nvr->data + addr);
+
+ if (nvpart->signature != OPENBIOS_PART_FREE)
+ continue;
+
+ len = be16_to_cpu(nvpart->len) << 4;
+ if (len < size)
+ size = len;
+
+ nvram_set_header(nvr, addr, signature, size, name);
+ if (len > size)
+ create_free_part(nvr, addr + size, len - size);
+ return size;
+ } while (next_nvpart(nvr, &addr, end) > 0 );
+ return -1;
}
-/* set a free Mac OS NVRAM partition */
-void pmac_format_nvram_partition (MacIONVRAMState *nvr, int len)
+/* set a system Mac OS NVRAM partition */
+void pmac_format_nvram_partition (MacIONVRAMState *nvr)
{
- uint8_t *buf;
- char partition_name[12] = "wwwwwwwwwwww";
-
- buf = nvr->data;
- buf[0] = 0x7f; /* free partition magic */
- buf[1] = 0; /* checksum */
- buf[2] = len >> 8;
- buf[3] = len;
- memcpy(buf + 4, partition_name, 12);
- buf[1] = nvram_chksum(buf, 16);
+ create_free_part(nvr, 0, sizeof(nvr->data));
+ create_nv_part(nvr, 0, sizeof(nvr->data),
+ OPENBIOS_PART_SYSTEM, "common", DEF_SYSTEM_SIZE);
}
diff --git a/hw/ppc_mac.h b/hw/ppc_mac.h
index c833d17..343c91e 100644
--- a/hw/ppc_mac.h
+++ b/hw/ppc_mac.h
@@ -64,9 +64,9 @@ PCIBus *pci_pmac_init(qemu_irq *pic);
/* Mac NVRAM */
typedef struct MacIONVRAMState MacIONVRAMState;
-MacIONVRAMState *macio_nvram_init (int *mem_index, target_phys_addr_t size);
+MacIONVRAMState *macio_nvram_init (int *mem_index, const char *filename);
void macio_nvram_map (void *opaque, target_phys_addr_t mem_base);
-void pmac_format_nvram_partition (MacIONVRAMState *nvr, int len);
+void pmac_format_nvram_partition (MacIONVRAMState *nvr);
uint32_t macio_nvram_read (void *opaque, uint32_t addr);
void macio_nvram_write (void *opaque, uint32_t addr, uint32_t val);
diff --git a/hw/ppc_oldworld.c b/hw/ppc_oldworld.c
index 73cf4ab..eb9f33f 100644
--- a/hw/ppc_oldworld.c
+++ b/hw/ppc_oldworld.c
@@ -348,8 +348,8 @@ static void ppc_heathrow_init (ram_addr_t ram_size, int vga_ram_size,
adb_kbd_init(&adb_bus);
adb_mouse_init(&adb_bus);
- nvr = macio_nvram_init(&nvram_mem_index, 0x2000);
- pmac_format_nvram_partition(nvr, 0x2000);
+ nvr = macio_nvram_init(&nvram_mem_index, "g3bw_nvram");
+ pmac_format_nvram_partition(nvr);
dbdma_init(&dbdma_mem_index);
--
1.5.6.5
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [Qemu-devel] Re: [PATCH 2/2][RFC] Load an OpenBios ELF image instead of OpenHackware binary object if found
2008-12-19 8:45 ` [Qemu-devel] Re: [PATCH 2/2][RFC] Load an OpenBios ELF image instead of OpenHackware binary object if found Aurelien Jarno
@ 2008-12-19 12:12 ` Paul Brook
2008-12-19 18:13 ` Blue Swirl
0 siblings, 1 reply; 12+ messages in thread
From: Paul Brook @ 2008-12-19 12:12 UTC (permalink / raw)
To: qemu-devel; +Cc: Blue Swirl, Laurent Vivier, Aurelien Jarno
On Friday 19 December 2008, Aurelien Jarno wrote:
> Laurent Vivier a écrit :
> > This patch try to load an OpenBIOS ELF image instead of
> > OpenHackware binary. Default behavior is used if the OpenBIOS
> > (openbios-ppc32) file is not found
>
> Actually, I wonder if it won't be simpler to just remove OpenHackware
> and always use the OpenBIOS image.
I'm inclined to agree.
Supporting two different bios just adds confusion, especially when they're
both broken.
Paul
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Qemu-devel] Re: [PATCH 0/2][RFC][PPC] openbios support
2008-12-19 10:55 laurent
@ 2008-12-19 17:50 ` Blue Swirl
2008-12-19 19:41 ` Laurent Vivier
0 siblings, 1 reply; 12+ messages in thread
From: Blue Swirl @ 2008-12-19 17:50 UTC (permalink / raw)
To: laurent@lvivier.info; +Cc: qemu-devel, aurelien
On 12/19/08, laurent@lvivier.info <laurent@lvivier.info> wrote:
> >On Fri, Dec 19, 2008 at 09:54:54AM +0100, laurent@lvivier.info wrote:
> >> >Laurent Vivier a écrit :
> >> >> These two patches allows to load an openbios elf image instead of an
> >> >> openhackware image.
> >> >>
> >> >> [PATCH 1/2][RFC] Modify hw/ppc_oldword.c to use qemu_ram_alloc().
> >> >> [PATCH 2/2][RFC] Load an OpenBios ELF image instead of OpenHackware
> >binary
> >> >
> >> >Great job! We are closer to get rid of OpenHackware.
> >> >
> >> >However I have tried those patches with the latest SVN from OpenBios,
> >> >and I am unable to get the machine booting. Do we need other patches for
> >> >OpenBios or QEMU? It would be nice to make them available, even if they
> >> >are not ready for merge.
> >>
> >> Yes, we need more patches:
> >>
> >> - for qemu, an nvram cleanup I already sent some month ago, and a little PCI
> >cleanup patch.
> >
> >Could you please resent it? I will apply it if everything is ok.
>
>
> Here it is.
>
> Note that the NVRAM is stored into a file.
One problem with this is that the file is written to current
directory, so running Qemu leaves these files everywhere. Maybe the
user should explicitly request using a NVRAM file and with that also
specify the location of it?
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Qemu-devel] Re: [PATCH 2/2][RFC] Load an OpenBios ELF image instead of OpenHackware binary object if found
2008-12-19 12:12 ` Paul Brook
@ 2008-12-19 18:13 ` Blue Swirl
0 siblings, 0 replies; 12+ messages in thread
From: Blue Swirl @ 2008-12-19 18:13 UTC (permalink / raw)
To: Paul Brook; +Cc: Laurent Vivier, qemu-devel, Aurelien Jarno
[-- Attachment #1: Type: text/plain, Size: 611 bytes --]
On 12/19/08, Paul Brook <paul@codesourcery.com> wrote:
> On Friday 19 December 2008, Aurelien Jarno wrote:
> > Laurent Vivier a écrit :
> > > This patch try to load an OpenBIOS ELF image instead of
> > > OpenHackware binary. Default behavior is used if the OpenBIOS
> > > (openbios-ppc32) file is not found
> >
> > Actually, I wonder if it won't be simpler to just remove OpenHackware
> > and always use the OpenBIOS image.
>
>
> I'm inclined to agree.
> Supporting two different bios just adds confusion, especially when they're
> both broken.
This would make things easier. Updated patch attached.
[-- Attachment #2: ppc_openbios.diff --]
[-- Type: plain/text, Size: 2193 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Qemu-devel] Re: [PATCH 0/2][RFC][PPC] openbios support
2008-12-19 17:50 ` Blue Swirl
@ 2008-12-19 19:41 ` Laurent Vivier
0 siblings, 0 replies; 12+ messages in thread
From: Laurent Vivier @ 2008-12-19 19:41 UTC (permalink / raw)
To: Blue Swirl; +Cc: qemu-devel, aurelien
Le 19 déc. 08 à 18:50, Blue Swirl a écrit :
> On 12/19/08, laurent@lvivier.info <laurent@lvivier.info> wrote:
>>> On Fri, Dec 19, 2008 at 09:54:54AM +0100, laurent@lvivier.info
>>> wrote:
>>>>> Laurent Vivier a écrit :
>>>>>> These two patches allows to load an openbios elf image instead
>>>>>> of an
>>>>>> openhackware image.
>>>>>>
>>>>>> [PATCH 1/2][RFC] Modify hw/ppc_oldword.c to use qemu_ram_alloc().
>>>>>> [PATCH 2/2][RFC] Load an OpenBios ELF image instead of
>>>>>> OpenHackware
>>> binary
>>>>>
>>>>> Great job! We are closer to get rid of OpenHackware.
>>>>>
>>>>> However I have tried those patches with the latest SVN from
>>>>> OpenBios,
>>>>> and I am unable to get the machine booting. Do we need other
>>>>> patches for
>>>>> OpenBios or QEMU? It would be nice to make them available, even
>>>>> if they
>>>>> are not ready for merge.
>>>>
>>>> Yes, we need more patches:
>>>>
>>>> - for qemu, an nvram cleanup I already sent some month ago, and a
>>>> little PCI
>>> cleanup patch.
>>>
>>> Could you please resent it? I will apply it if everything is ok.
>>
>>
>> Here it is.
>>
>> Note that the NVRAM is stored into a file.
>
> One problem with this is that the file is written to current
> directory, so running Qemu leaves these files everywhere. Maybe the
> user should explicitly request using a NVRAM file and with that also
> specify the location of it?
Yes, I think it's a good idea, if no parameters is given the nvram is
only stored in memory. I rework this patch
Thank you,
Laurent
----------------------- Laurent Vivier ----------------------
"The best way to predict the future is to invent it."
- Alan Kay
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Qemu-devel] Re: [PATCH 0/2][RFC][PPC] openbios support
2008-12-19 8:45 ` [Qemu-devel] Re: [PATCH 0/2][RFC][PPC] openbios support Aurelien Jarno
@ 2008-12-20 7:54 ` François Revol
0 siblings, 0 replies; 12+ messages in thread
From: François Revol @ 2008-12-20 7:54 UTC (permalink / raw)
To: qemu-devel
> Laurent Vivier a écrit :
> > These two patches allows to load an openbios elf image instead of
> > an
> > openhackware image.
> >
> > [PATCH 1/2][RFC] Modify hw/ppc_oldword.c to use qemu_ram_alloc().
> > [PATCH 2/2][RFC] Load an OpenBios ELF image instead of OpenHackware
> > binary
>
> Great job! We are closer to get rid of OpenHackware.
Cool!
Sadly I've lost access to the server I used to test ppc builds (stupid
ISP going bankrupt without warning), I'll have to make room on disks
here to resume work.
François.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Qemu-devel] Re: [PATCH 1/2][RFC] Modify hw/ppc_oldword.c to use qemu_ram_alloc().
[not found] ` <1229635267-16897-2-git-send-email-Laurent@lvivier.info>
[not found] ` <1229635267-16897-3-git-send-email-Laurent@lvivier.info>
2008-12-19 8:45 ` [Qemu-devel] Re: [PATCH 1/2][RFC] Modify hw/ppc_oldword.c to use qemu_ram_alloc() Aurelien Jarno
@ 2008-12-20 23:41 ` Aurelien Jarno
2 siblings, 0 replies; 12+ messages in thread
From: Aurelien Jarno @ 2008-12-20 23:41 UTC (permalink / raw)
To: Laurent Vivier; +Cc: Blue Swirl, qemu-devel
On Thu, Dec 18, 2008 at 10:21:06PM +0100, Laurent Vivier wrote:
> This patch uses qemu_ram_alloc() to allocate RAM, VGA RAM and VGA BIOS.
>
> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
> Signed-off-by: Laurent Vivier <Laurent@lvivier.info>
Thanks, I have applied it.
> ---
> hw/ppc_oldworld.c | 21 ++++++++++++---------
> 1 files changed, 12 insertions(+), 9 deletions(-)
>
> diff --git a/hw/ppc_oldworld.c b/hw/ppc_oldworld.c
> index 0265596..696add2 100644
> --- a/hw/ppc_oldworld.c
> +++ b/hw/ppc_oldworld.c
> @@ -34,6 +34,7 @@
> #include "boards.h"
>
> #define MAX_IDE_BUS 2
> +#define VGA_BIOS_SIZE 65536
>
> /* temporary frame buffer OSI calls for the video.x driver. The right
> solution is to modify the driver to use VGA PCI I/Os */
> @@ -116,7 +117,7 @@ static void ppc_heathrow_init (ram_addr_t ram_size, int vga_ram_size,
> nvram_t nvram;
> m48t59_t *m48t59;
> int linux_boot, i;
> - unsigned long bios_offset, vga_bios_offset;
> + ram_addr_t ram_offset, vga_ram_offset, bios_offset, vga_bios_offset;
> uint32_t kernel_base, kernel_size, initrd_base, initrd_size;
> PCIBus *pci_bus;
> MacIONVRAMState *nvr;
> @@ -154,10 +155,14 @@ static void ppc_heathrow_init (ram_addr_t ram_size, int vga_ram_size,
> }
>
> /* allocate RAM */
> - cpu_register_physical_memory(0, ram_size, IO_MEM_RAM);
> + ram_offset = qemu_ram_alloc(ram_size);
> + cpu_register_physical_memory(0, ram_size, ram_offset);
> +
> + /* allocate VGA RAM */
> + vga_ram_offset = qemu_ram_alloc(vga_ram_size);
>
> /* allocate and load BIOS */
> - bios_offset = ram_size + vga_ram_size;
> + bios_offset = qemu_ram_alloc(BIOS_SIZE);
> if (bios_name == NULL)
> bios_name = BIOS_FILENAME;
> snprintf(buf, sizeof(buf), "%s/%s", bios_dir, bios_name);
> @@ -166,7 +171,6 @@ static void ppc_heathrow_init (ram_addr_t ram_size, int vga_ram_size,
> cpu_abort(env, "qemu: could not load PowerPC bios '%s'\n", buf);
> exit(1);
> }
> - bios_size = (bios_size + 0xfff) & ~0xfff;
> if (bios_size > 0x00080000) {
> /* As the NVRAM is located at 0xFFF04000, we cannot use 1 MB BIOSes */
> cpu_abort(env, "G3BW Mac hardware can not handle 1 MB BIOS\n");
> @@ -175,7 +179,7 @@ static void ppc_heathrow_init (ram_addr_t ram_size, int vga_ram_size,
> bios_size, bios_offset | IO_MEM_ROM);
>
> /* allocate and load VGA BIOS */
> - vga_bios_offset = bios_offset + bios_size;
> + vga_bios_offset = qemu_ram_alloc(VGA_BIOS_SIZE);
> snprintf(buf, sizeof(buf), "%s/%s", bios_dir, VGABIOS_FILENAME);
> vga_bios_size = load_image(buf, phys_ram_base + vga_bios_offset + 8);
> if (vga_bios_size < 0) {
> @@ -193,7 +197,6 @@ static void ppc_heathrow_init (ram_addr_t ram_size, int vga_ram_size,
> vga_bios_size);
> vga_bios_size += 8;
> }
> - vga_bios_size = (vga_bios_size + 0xfff) & ~0xfff;
>
> if (linux_boot) {
> kernel_base = KERNEL_LOAD_ADDR;
> @@ -278,8 +281,8 @@ static void ppc_heathrow_init (ram_addr_t ram_size, int vga_ram_size,
> }
> pic = heathrow_pic_init(&pic_mem_index, 1, heathrow_irqs);
> pci_bus = pci_grackle_init(0xfec00000, pic);
> - pci_vga_init(pci_bus, ds, phys_ram_base + ram_size,
> - ram_size, vga_ram_size,
> + pci_vga_init(pci_bus, ds, phys_ram_base + vga_ram_offset,
> + vga_ram_offset, vga_ram_size,
> vga_bios_offset, vga_bios_size);
>
> /* XXX: suppress that */
> @@ -369,6 +372,6 @@ QEMUMachine heathrow_machine = {
> .name = "g3bw",
> .desc = "Heathrow based PowerMAC",
> .init = ppc_heathrow_init,
> - .ram_require = BIOS_SIZE + VGA_RAM_SIZE,
> + .ram_require = BIOS_SIZE + VGA_BIOS_SIZE + VGA_RAM_SIZE,
> .max_cpus = MAX_CPUS,
> };
> --
> 1.5.6.5
>
>
--
.''`. Aurelien Jarno | GPG: 1024D/F1BCDB73
: :' : Debian developer | Electrical Engineer
`. `' aurel32@debian.org | aurelien@aurel32.net
`- people.debian.org/~aurel32 | www.aurel32.net
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2008-12-20 23:41 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1229635267-16897-1-git-send-email-Laurent@lvivier.info>
2008-12-19 8:45 ` [Qemu-devel] Re: [PATCH 0/2][RFC][PPC] openbios support Aurelien Jarno
2008-12-20 7:54 ` François Revol
[not found] ` <1229635267-16897-2-git-send-email-Laurent@lvivier.info>
[not found] ` <1229635267-16897-3-git-send-email-Laurent@lvivier.info>
2008-12-19 8:45 ` [Qemu-devel] Re: [PATCH 2/2][RFC] Load an OpenBios ELF image instead of OpenHackware binary object if found Aurelien Jarno
2008-12-19 12:12 ` Paul Brook
2008-12-19 18:13 ` Blue Swirl
2008-12-19 8:45 ` [Qemu-devel] Re: [PATCH 1/2][RFC] Modify hw/ppc_oldword.c to use qemu_ram_alloc() Aurelien Jarno
2008-12-20 23:41 ` Aurelien Jarno
2008-12-19 8:54 [Qemu-devel] Re: [PATCH 0/2][RFC][PPC] openbios support laurent
2008-12-19 10:23 ` Aurelien Jarno
-- strict thread matches above, loose matches on Subject: below --
2008-12-19 10:55 laurent
2008-12-19 17:50 ` Blue Swirl
2008-12-19 19:41 ` Laurent Vivier
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).