From: Alexander Graf <agraf@suse.de>
To: QEMU Developers <qemu-devel@nongnu.org>
Cc: Isaku Yamahata <yamahata@valinux.co.jp>,
Aurelien Jarno <aurelien@aurel32.net>,
"Michael S. Tsirkin" <mst@redhat.com>
Subject: [Qemu-devel] [PATCH 2/9] PPC: Add config space conversion function for uni_north
Date: Tue, 12 Jan 2010 12:58:39 +0100 [thread overview]
Message-ID: <1263297526-13518-3-git-send-email-agraf@suse.de> (raw)
In-Reply-To: <1263297526-13518-1-git-send-email-agraf@suse.de>
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2501 bytes --]
As stated in the previous patch, the Uninorth PCI bridge requires different
layouts in its PCI config space accessors.
This patch introduces a conversion function that makes it compatible with
the way Linux accesses it.
I also kept an OpenBIOS compatibility hack in. I think it'd be better to
take small steps here and do the config space access rework in OpenBIOS
later on. When that's done we can remove that hack.
Signed-off-by: Alexander Graf <agraf@suse.de>
CC: Michael S. Tsirkin <mst@redhat.com>
CC: Isaku Yamahata <yamahata@valinux.co.jp>
---
v1 -> v2:
- convert Uninorth to use config space decoder
v2 -> v3:
- stick to new naming scheme
---
hw/unin_pci.c | 31 +++++++++++++++++++++++++++++++
1 files changed, 31 insertions(+), 0 deletions(-)
diff --git a/hw/unin_pci.c b/hw/unin_pci.c
index fdb9401..64ad23e 100644
--- a/hw/unin_pci.c
+++ b/hw/unin_pci.c
@@ -75,6 +75,36 @@ static void pci_unin_reset(void *opaque)
{
}
+static void unin_decode_config_addr(PCIHostState *s, uint32_t config_reg,
+ PCIConfigAddress *decoded)
+{
+ decoded->addr.domain = s->bus;
+ decoded->addr_mask = 7;
+ decoded->offset = config_reg & 0xfc;
+ decoded->addr.fn = (config_reg >> 8) & 0x7;
+
+ if (config_reg & (1u << 31)) {
+ /* XXX OpenBIOS compatibility hack */
+ pci_host_decode_config_addr(s, config_reg, decoded);
+ } else if (config_reg & 1) {
+ /* CFA1 style values */
+
+ decoded->valid = (config_reg & 1) ? true : false;
+ decoded->addr.bus = (config_reg >> 16) & 0xff;
+ decoded->addr.slot = (config_reg >> 11) & 0x1f;
+ } else {
+ /* CFA0 style values */
+
+ decoded->valid = true;
+ decoded->addr.bus = 0;
+ decoded->addr.slot = ffs(config_reg & 0xfffff800) - 1;
+ }
+
+ UNIN_DPRINTF("Converted config space accessor %08x -> %02x %02x %x\n",
+ config_reg, decoded->addr.bus, decoded->addr.slot,
+ decoded->addr.fn);
+}
+
static int pci_unin_main_init_device(SysBusDevice *dev)
{
UNINState *s;
@@ -85,6 +115,7 @@ static int pci_unin_main_init_device(SysBusDevice *dev)
s = FROM_SYSBUS(UNINState, dev);
pci_host_init(&s->host_state);
+ s->host_state.decode_config_addr = unin_decode_config_addr;
pci_mem_config = pci_host_conf_register_mmio(&s->host_state);
pci_mem_data = pci_host_data_register_mmio(&s->host_state);
sysbus_init_mmio(dev, 0x1000, pci_mem_config);
--
1.6.0.2
next prev parent reply other threads:[~2010-01-12 11:59 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-12 11:58 [Qemu-devel] [PATCH 0/9] PPC NewWorld fixery v3 Alexander Graf
2010-01-12 11:58 ` [Qemu-devel] [PATCH 1/9] PCI: PCI config space access overhaul Alexander Graf
2010-01-12 11:58 ` Alexander Graf [this message]
2010-01-12 11:58 ` [Qemu-devel] [PATCH 3/9] PPC: Use Mac99_U3 type on ppc64 Alexander Graf
2010-01-12 11:58 ` [Qemu-devel] [PATCH 4/9] PPC: Include dump of lspci -nn on real G5 Alexander Graf
2010-01-12 20:16 ` Blue Swirl
2010-01-12 20:35 ` Alexander Graf
2010-01-12 20:43 ` Blue Swirl
2010-01-12 20:51 ` Alexander Graf
2010-01-12 11:58 ` [Qemu-devel] [PATCH 5/9] PPC: Make interrupts work Alexander Graf
2010-01-12 11:58 ` [Qemu-devel] [PATCH 6/9] PPC: tell the guest about the time base frequency Alexander Graf
2010-01-12 11:58 ` [Qemu-devel] [PATCH 7/9] PPC: Use macio IDE controller for Newworld Alexander Graf
2010-01-12 11:58 ` [Qemu-devel] [PATCH 8/9] PPC: Get rid of segfaults in DBDMA emulation Alexander Graf
2010-01-12 11:58 ` [Qemu-devel] [PATCH 9/9] PPC: Add USB per default on U3 Alexander Graf
2010-01-12 21:54 ` Andreas Färber
2010-01-12 22:03 ` Alexander Graf
2010-01-12 19:45 ` [Qemu-devel] [PATCH 0/9] PPC NewWorld fixery v3 Blue Swirl
2010-01-12 20:34 ` Alexander Graf
2010-01-12 20:52 ` Blue Swirl
2010-01-12 22:11 ` Alexander Graf
2010-01-13 18:47 ` Blue Swirl
2010-01-13 19:17 ` Alexander Graf
2010-01-13 19:37 ` Blue Swirl
2010-01-13 19:43 ` Alexander Graf
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=1263297526-13518-3-git-send-email-agraf@suse.de \
--to=agraf@suse.de \
--cc=aurelien@aurel32.net \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=yamahata@valinux.co.jp \
/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).