[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 2/9] PPC: Add config space conversion function for u
From: |
Alexander Graf |
Subject: |
[Qemu-devel] [PATCH 2/9] PPC: Add config space conversion function for uni_north |
Date: |
Tue, 12 Jan 2010 12:58:39 +0100 |
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 <address@hidden>
CC: Michael S. Tsirkin <address@hidden>
CC: Isaku Yamahata <address@hidden>
---
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
- [Qemu-devel] [PATCH 4/9] PPC: Include dump of lspci -nn on real G5, (continued)
[Qemu-devel] [PATCH 9/9] PPC: Add USB per default on U3, Alexander Graf, 2010/01/12
[Qemu-devel] [PATCH 5/9] PPC: Make interrupts work, Alexander Graf, 2010/01/12
[Qemu-devel] [PATCH 3/9] PPC: Use Mac99_U3 type on ppc64, Alexander Graf, 2010/01/12
[Qemu-devel] [PATCH 2/9] PPC: Add config space conversion function for uni_north,
Alexander Graf <=
[Qemu-devel] [PATCH 7/9] PPC: Use macio IDE controller for Newworld, Alexander Graf, 2010/01/12
Re: [Qemu-devel] [PATCH 0/9] PPC NewWorld fixery v3, Blue Swirl, 2010/01/12
- Re: [Qemu-devel] [PATCH 0/9] PPC NewWorld fixery v3, Alexander Graf, 2010/01/12
- Re: [Qemu-devel] [PATCH 0/9] PPC NewWorld fixery v3, Blue Swirl, 2010/01/12
- Re: [Qemu-devel] [PATCH 0/9] PPC NewWorld fixery v3, Alexander Graf, 2010/01/12
- Re: [Qemu-devel] [PATCH 0/9] PPC NewWorld fixery v3, Blue Swirl, 2010/01/13
- Re: [Qemu-devel] [PATCH 0/9] PPC NewWorld fixery v3, Alexander Graf, 2010/01/13
- Re: [Qemu-devel] [PATCH 0/9] PPC NewWorld fixery v3, Blue Swirl, 2010/01/13
- Re: [Qemu-devel] [PATCH 0/9] PPC NewWorld fixery v3, Alexander Graf, 2010/01/13