aboutsummaryrefslogtreecommitdiff
path: root/hw/pci.c
diff options
context:
space:
mode:
authorStefan Weil <weil@mail.berlios.de>2009-11-13 23:26:27 +0100
committerAurelien Jarno <aurelien@aurel32.net>2009-11-14 01:14:26 +0100
commit91011d4f3b7c311a42b842f6682ac64a2372d2b7 (patch)
tree33a8e3f2e6d2006dd29d6e255f5497fdd99a1bb8 /hw/pci.c
parente16ad5b0442931e6b76be246cf9dd2866ce352c8 (diff)
pci: Fix function pci_default_write_config
Change 260c0cd3d985e51b15870ff47e17b7b930efbda1 (pci: use range helper functions) introduced a bug which made pci cirrus vga on mips malta (and maybe other pci devices) fail. Don't change addr - its original value is needed by ranges_overlap() and range_covers(). Signed-off-by: Stefan Weil <weil@mail.berlios.de> Acked-by: Ryan Harper <ryanh@us.ibm.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Diffstat (limited to 'hw/pci.c')
-rw-r--r--hw/pci.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/hw/pci.c b/hw/pci.c
index a326930d4f..6864339c27 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -856,9 +856,9 @@ void pci_default_write_config(PCIDevice *d, uint32_t addr, uint32_t val, int l)
int i;
uint32_t config_size = pci_config_size(d);
- for(i = 0; i < l && addr < config_size; val >>= 8, ++i, ++addr) {
- uint8_t wmask = d->wmask[addr];
- d->config[addr] = (d->config[addr] & ~wmask) | (val & wmask);
+ for (i = 0; i < l && addr + i < config_size; val >>= 8, ++i) {
+ uint8_t wmask = d->wmask[addr + i];
+ d->config[addr + i] = (d->config[addr + i] & ~wmask) | (val & wmask);
}
if (ranges_overlap(addr, l, PCI_BASE_ADDRESS_0, 24) ||
ranges_overlap(addr, l, PCI_ROM_ADDRESS, 4) ||