qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Graf <agraf@suse.de>
To: qemu-ppc@nongnu.org
Cc: programmingkidx@gmail.com, mark.cave-ayland@ilande.co.uk,
	qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 5/5] PPC: mac99: Expose NVRAM linearly
Date: Sun, 13 Jul 2014 18:17:33 +0200	[thread overview]
Message-ID: <1405268253-33465-6-git-send-email-agraf@suse.de> (raw)
In-Reply-To: <1405268253-33465-1-git-send-email-agraf@suse.de>

The mac99 machine really doesn't have any shifts in NVRAM usage. It simply has
a 1:1 MMIO mapped space where a guest can access the NVRAM data.

This patch fixes up the incorrect format we use for NVRAM today, making Mac OS
X happy and able to read NVRAM.

This patch also requires a new OpenBIOS version. To ensure bisectaibility,
we provide a fw_cfg hint to tell OpenBIOS that NVRAM is now flat.

Signed-off-by: Alexander Graf <agraf@suse.de>

---

WARNING! This patch breaks compatibility with older OpenBIOS which can
no longer read data from NVRAM after this patch is applied to populate
its prom variables.
---
 hw/ppc/mac_newworld.c | 7 ++++---
 include/hw/ppc/ppc.h  | 1 +
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c
index e96b635..32ee2f2 100644
--- a/hw/ppc/mac_newworld.c
+++ b/hw/ppc/mac_newworld.c
@@ -435,12 +435,12 @@ static void ppc_core99_init(MachineState *machine)
     }
 #endif
     dev = qdev_create(NULL, TYPE_MACIO_NVRAM);
-    qdev_prop_set_uint32(dev, "size", 0x2000);
-    qdev_prop_set_uint32(dev, "it_shift", 1);
+    qdev_prop_set_uint32(dev, "size", 0x4000);
+    qdev_prop_set_uint32(dev, "it_shift", 0);
     qdev_init_nofail(dev);
     sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, nvram_addr);
     nvr = MACIO_NVRAM(dev);
-    pmac_format_nvram_partition(nvr, 0x2000);
+    pmac_format_nvram_partition(nvr, 0x4000);
     /* No PCI init: the BIOS will do it */
 
     fw_cfg = fw_cfg_init(0, 0, CFG_ADDR, CFG_ADDR + 2);
@@ -482,6 +482,7 @@ static void ppc_core99_init(MachineState *machine)
     fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_CLOCKFREQ, CLOCKFREQ);
     fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_BUSFREQ, BUSFREQ);
     fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_NVRAM_ADDR, nvram_addr);
+    fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_NVRAM_FLAT, 1);
 
     qemu_register_boot_set(fw_cfg_boot_set, fw_cfg);
 }
diff --git a/include/hw/ppc/ppc.h b/include/hw/ppc/ppc.h
index 14efd0c..7b13cee 100644
--- a/include/hw/ppc/ppc.h
+++ b/include/hw/ppc/ppc.h
@@ -94,6 +94,7 @@ enum {
 #define FW_CFG_PPC_KVM_PID      (FW_CFG_ARCH_LOCAL + 0x07)
 #define FW_CFG_PPC_NVRAM_ADDR   (FW_CFG_ARCH_LOCAL + 0x08)
 #define FW_CFG_PPC_BUSFREQ      (FW_CFG_ARCH_LOCAL + 0x09)
+#define FW_CFG_PPC_NVRAM_FLAT   (FW_CFG_ARCH_LOCAL + 0x0a)
 
 #define PPC_SERIAL_MM_BAUDBASE 399193
 
-- 
1.8.1.4

  parent reply	other threads:[~2014-07-13 16:17 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-13 16:17 [Qemu-devel] [PATCH 0/5] PPC: Mac99 emulation fixes Alexander Graf
2014-07-13 16:17 ` [Qemu-devel] [PATCH 1/5] PPC: mac99: Fix core99 timer frequency Alexander Graf
2014-07-13 16:17 ` [Qemu-devel] [PATCH 2/5] PPC: mac_nvram: Remove unused functions Alexander Graf
2014-07-13 16:17 ` [Qemu-devel] [PATCH 3/5] PPC: mac_nvram: Allow 2 and 4 byte accesses Alexander Graf
2014-07-14  6:41   ` Paolo Bonzini
2014-07-14 10:32     ` Alexander Graf
2014-07-14 10:37     ` [Qemu-devel] [PATCH v2 " Alexander Graf
2014-07-13 16:17 ` [Qemu-devel] [PATCH 4/5] PPC: mac_nvram: Split NVRAM into OF and OSX parts Alexander Graf
2014-07-13 16:17 ` Alexander Graf [this message]
2014-07-13 17:51 ` [Qemu-devel] [PATCH 0/5] PPC: Mac99 emulation fixes Programmingkid
2014-07-13 18:01   ` Alexander Graf
2014-07-14 13:58 ` Mark Cave-Ayland
2014-07-14 14:00   ` Alexander Graf
2014-07-14 14:07     ` Mark Cave-Ayland

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=1405268253-33465-6-git-send-email-agraf@suse.de \
    --to=agraf@suse.de \
    --cc=mark.cave-ayland@ilande.co.uk \
    --cc=programmingkidx@gmail.com \
    --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).