Signed-off-by: Liu Yu <yu....@freescale.com> --- hw/ppce500_pci.c | 26 ++++++++++++++++---------- 1 files changed, 16 insertions(+), 10 deletions(-)
diff --git a/hw/ppce500_pci.c b/hw/ppce500_pci.c index 2db365d..3e24e85 100644 --- a/hw/ppce500_pci.c +++ b/hw/ppce500_pci.c @@ -108,15 +108,18 @@ static uint32_t pci_reg_read4(void *opaque, target_phys_addr_t addr) case PPCE500_PCI_IW3: case PPCE500_PCI_IW2: - case PPCE500_PCI_IW1: + case PPCE500_PCI_IW1: { + int idx = ((addr >> 5) & 0x3) - 1; + switch (addr & 0xC) { - case PCI_PITAR: value = pci->pib[(addr >> 5) & 0x3].pitar; break; - case PCI_PIWBAR: value = pci->pib[(addr >> 5) & 0x3].piwbar; break; - case PCI_PIWBEAR: value = pci->pib[(addr >> 5) & 0x3].piwbear; break; - case PCI_PIWAR: value = pci->pib[(addr >> 5) & 0x3].piwar; break; + case PCI_PITAR: value = pci->pib[idx].pitar; break; + case PCI_PIWBAR: value = pci->pib[idx].piwbar; break; + case PCI_PIWBEAR: value = pci->pib[idx].piwbear; break; + case PCI_PIWAR: value = pci->pib[idx].piwar; break; default: break; }; break; + } case PPCE500_PCI_GASKET_TIMR: value = pci->gasket_time; @@ -164,15 +167,18 @@ static void pci_reg_write4(void *opaque, target_phys_addr_t addr, case PPCE500_PCI_IW3: case PPCE500_PCI_IW2: - case PPCE500_PCI_IW1: + case PPCE500_PCI_IW1: { + int idx = ((addr >> 5) & 0x3) - 1; + switch (addr & 0xC) { - case PCI_PITAR: pci->pib[(addr >> 5) & 0x3].pitar = value; break; - case PCI_PIWBAR: pci->pib[(addr >> 5) & 0x3].piwbar = value; break; - case PCI_PIWBEAR: pci->pib[(addr >> 5) & 0x3].piwbear = value; break; - case PCI_PIWAR: pci->pib[(addr >> 5) & 0x3].piwar = value; break; + case PCI_PITAR: pci->pib[idx].pitar = value; break; + case PCI_PIWBAR: pci->pib[idx].piwbar = value; break; + case PCI_PIWBEAR: pci->pib[idx].piwbear = value; break; + case PCI_PIWAR: pci->pib[idx].piwar = value; break; default: break; }; break; + } case PPCE500_PCI_GASKET_TIMR: pci->gasket_time = value; -- 1.6.4